You Don't Know JS: this & Object Prototypes
Author | : Kyle Simpson |
Publisher | : "O'Reilly Media, Inc." |
Total Pages | : 173 |
Release | : 2014-07-11 |
ISBN-10 | : 9781491904145 |
ISBN-13 | : 1491904143 |
Rating | : 4/5 (45 Downloads) |
Book excerpt: No matter how much experience you have with JavaScript, odds are you don’t fully understand the language. This concise, in-depth guide takes you inside JavaScript’s this structure and object prototypes. You’ll learn how they work and why they’re integral to behavior delegation—a design pattern in which objects are linked, rather than cloned. Like other books in the “You Don’t Know JS” series, this and Object Prototypes dives into trickier parts of the language that many JavaScript programmers simply avoid. Armed with this knowledge, you can become a true JavaScript master. With this book you will: Explore how the this binding points to objects based on how the function is called Look into the nature of JS objects and why you’d need to point to them Learn how developers use the mixin pattern to fake classes in JS Examine how JS’s prototype mechanism forms links between objects Learn how to move from class/inheritance design to behavior delegation Understand how the OLOO (objects-linked-to-other-objects) coding style naturally implements behavior delegation