Shop now Shop Clothing clo_fly_aw15_NA_shoes Shop All Shop All Amazon Fashion Cloud Drive Photos Shop Amazon Fire TV Shop now Shop Fire HD 6 Shop Kindle Voyage Shop Now Shop now
Start reading You Don't Know JS: this & Object Prototypes on your Kindle in under a minute. Don't have a Kindle? Get your Kindle here or start reading now with a free Kindle Reading App.

Deliver to your Kindle or other device


Try it free

Sample the beginning of this book for free

Deliver to your Kindle or other device

Sorry, this item is not available in
Image not available for
Image not available

You Don't Know JS: this & Object Prototypes [Kindle Edition]

Kyle Simpson
4.7 out of 5 stars  See all reviews (3 customer reviews)

Print List Price: £14.50
Kindle Price: £10.44 includes VAT* & free wireless delivery via Amazon Whispernet
You Save: £4.06 (28%)
* Unlike print books, digital books are subject to VAT.

Free Kindle Reading App Anybody can read Kindle books—even without a Kindle device—with the FREE Kindle app for smartphones, tablets and computers.

To get the free app, enter your e-mail address or mobile phone number.


Amazon Price New from Used from
Kindle Edition £10.44  
Paperback £13.14  
Celebrate 5 Years of Kindle
Celebrate 5 Years of Kindle: Bestsellers for 99p
For five days starting 2nd September, 2015 we'll reveal a selection of bestsellers from the last 5 years, on sale for 99p for one day only -- come back each day to see the next selection of favourites for 99p. >Shop now

Book Description

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

Customers Who Bought This Item Also Bought

Page of Start over
This shopping feature will continue to load items. In order to navigate out of this carousel please use your heading shortcut key to navigate to the next or previous heading.

Product Description

About the Author

Kyle Simpson is an Open Web Evangelist from Austin, TX. He's passionate about JavaScript, HTML5, real-time/peer-to-peer communications, and web performance. Otherwise, he's probably bored by it. Kyle is an author, workshop trainer, tech speaker, and avid OSS community member.

Product details

  • Format: Kindle Edition
  • File Size: 1382 KB
  • Print Length: 176 pages
  • Page Numbers Source ISBN: 1491904151
  • Simultaneous Device Usage: Unlimited
  • Publisher: O'Reilly Media; 1 edition (11 July 2014)
  • Sold by: Amazon Media EU S.à r.l.
  • Language: English
  • Text-to-Speech: Enabled
  • X-Ray:
  • Word Wise: Not Enabled
  • Enhanced Typesetting: Not Enabled
  • Average Customer Review: 4.7 out of 5 stars  See all reviews (3 customer reviews)
  • Amazon Bestsellers Rank: #209,238 Paid in Kindle Store (See Top 100 Paid in Kindle Store)
  •  Would you like to give feedback on images?

More About the Author

Discover books, learn about writers, and more.

What Other Items Do Customers Buy After Viewing This Item?

Customer Reviews

3 star
2 star
1 star
4.7 out of 5 stars
4.7 out of 5 stars
Most Helpful Customer Reviews
4.0 out of 5 stars A full, if somewhat verbose, exposition 7 Jun. 2015
Format:Paperback|Verified Purchase
Kyle Simpson's explanations of the behaviour of 'this' and of prototypal inheritance in JavaScript are the best I've seen, albeit a bit belaboured and verbose at times, including a very lengthy diversion on 'how not to do it' by trying to coerce a kind of pseudo-class-based inheritance upon the language. It could have been a considerably briefer work, and combined with other volumes in the series.

It also includes mention of forthcoming ECMA 6 features (though full discussion of these will be left to a forthcoming publication You Don't Know JS: ES6 & Beyond) including an appendix which is useful warning about how the new ECMA 6 class syntax obscures what is happening, being syntactic sugar and in fact nothing to do with classes at all and still using prototypal inheritance under the hood, and could actually cause more problems than it might solve.

Not everyone might agree which the author's suggestions about the best way to go about writing JavaScript code, but it definitely gives food for thought and it's certainly worth the outlay (especially if, like me, you are coming to JavaScript from a fully object-oriented language like C#) and I'll be purchasing others in the series too.
Comment | 
Was this review helpful to you?
Format:Kindle Edition|Verified Purchase
This is a must for any intermediate to senior Javascript Developer.
The book is clear, well written with good examples to demonstrate.
All good JavaScript Developers should know the ins and outs of 'this' and Object Prototypes, and no other book I have read, covers these concepts as well as this book. Well worth the read!
Comment | 
Was this review helpful to you?
5.0 out of 5 stars Five Stars 5 May 2015
By S Lewis
Format:Paperback|Verified Purchase
This series is a must have for anyone interested in getting stuff done with javascript
Comment | 
Was this review helpful to you?
Most Helpful Customer Reviews on (beta) 4.4 out of 5 stars  27 reviews
9 of 9 people found the following review helpful
5.0 out of 5 stars An excellent introduction to a complex topic 15 Aug. 2014
By Matthew - Published on
Kyle Simpson explains the semantics of using "this" in Javascript and why it is not the same as Java. The Javascript keyword "this" is often misunderstood. Many works treat it as the Javascript equivalent of Java's "this" or Python's "self," and while that understanding will lead to working programs in most cases, Simpson explains where that understanding will break down in a way that many programmers will not be able to anticipate. He later discusses Javascript's prototypal inheritance and how it works different than typical inheritance designs.

This text should not be a first introduction to the language and maybe not even a second or third. The topics covered are quite advanced and require a relatively high familiarity with Javascript to begin to understand. At times the text can be very confusing and require re-reading sections to fully grasp, however this is due to the complexity of the material covered and not due the author. The author's writing style is quite clear and his examples are well explained. Code samples are very short and to the point, not wasting space with unnecessary filler code which so many technical books do (pages of GUI code for explaining a simple input/output example for instance).

This is the first example I have seen of covering these topics in this manner, and while at first I was unsure if they really warranted their own book, I did not realize how poorly I understood the semantics of "this." I would highly recommend the text to anybody who expects to do much work in Javascript, in particular in creating or working with frameworks, where a full knowledge of the topics covered could prove indispensible. After reading this text, I would be interested in reading the other texts in the series as well.

(I received an electronic copy of the book as part of OReilly's reader review program.)
3 of 3 people found the following review helpful
5.0 out of 5 stars More than just a Javascript book.... 1 Sept. 2014
By astericky - Published on
'this and Object prototypes' is the second book in the 'You Don't know Javascript' book series. I would argue that this book probably could've served as the first book becuase this book challenges developers to actually re-consider the need of and use of the classical design patterns and assessing the benefits and drawbacks of it. In other words it challenges developers to actually be engineers instead of just developers.

It is my opinion that I and other developers have been lazy in that we just accept classical software design as the way software should be developed without really thinking about what that actually means and the benefits and drawbacks of classical design patterns. Rather than fully embracing the benefit of behavior based delegation-oriented design in Javascript, developers have typically shoe-horned in the classical design patterns into Javascript.

If you were even mildly disappointed in the first book in this series 'Scope and Closures', you will pleased to know that this book is head and shoulders better than the first book in this series and really is a shining example of what a good programming book should do is challenge you to think about software design in ways you had not previously really given much thought to.

Gone is the somewhat pretentious tone of the previous book. Instead the author takes a different tone as he aims to teach developers think about the implications of classical and behavioral design patterns. It is as if Kyle got better at writing a book that people can read and learn from. There are plenty of code examples along with detailed explanations of what Javascript is actually doing behind the scenes. This may actually just be a good computer science book to have in general. I am very happy with what I have learned from this book.

The last three chapters that compare classical vs behavior based design patterns in javascript really is worth the price of this book. This book is very well written and I think the last three chapters of this book has uses as a computer science topic in general and should not be limited to just a discussion about Javascript hence the 5 out of 5 stars I a giving it.
3 of 3 people found the following review helpful
5.0 out of 5 stars Javascript: "the tough parts" 4 Oct. 2014
By Thomas B. Gross - Published on
Format:Paperback|Vine Customer Review of Free Product (What's this?)
I can't quite decide if this is a great book attempting to teach the subtleties of a cryptic programming language or if the "bad parts" of Javascript just aren't worth knowing about. Ultimately I'm pretty psyched by this book and its approach to the subject matter by focusing on select topics in the language, and I'm really looking forward to reading other books in this "You Don't Know JS" series.

I've been putzing about in JS for about a year, teaching myself how to do things by googling individual topics. The only book I've consulted in the past is "Javascript: the Good Parts" - I am very much part of the intended target audience for this book, that is, people who have learned just enough JS "to get by" and use the language just as a way to connect buttons to JSON requests. I confess I did not even know that Javascript has objects or a "this" before reading this book.

The entire text of the book is available online as a free pdf file to download. I have no idea why O'Reilly allows this for so many of their books now (I do not think the various sites that offer these downloads are pirating anything). In any case, this is a nicely bound book in a convenient size; I've been putting it in my knapsack and reading it on the train to and from work.
2 of 2 people found the following review helpful
5.0 out of 5 stars Excellent second book 7 Nov. 2014
By D. Wortham - Published on
Format:Paperback|Vine Customer Review of Free Product (What's this?)
Me, for comparison to your JS level: About two years ago I started writing JS code for the first time when I found out how easy Chrome had made extension development and I've written several extensions for personal use. I've used Delphi (pascal) in the past for writing small utility programs for my use. I'd characterize myself as past beginner and but not intermediate. I write my extensions to work without worrying too much about efficiency or elegance taking advantage of JQuery's super duper framework.

Following up and building on the previous book in the series, Scope & Closures, Simpson delves into JS' *this* explaining the whys and wherefores of it. If you are about my level then I think you should read the first book before this one because having a better understanding of scope and closure will help in seeing how *this* is implemented in JS. It does not follow scope rules but uses call-sites. Simpson goes over what call-site means and then explains the four binding rules for *this*: default, implicit, explicit (plus its close relative - hard binding) and new; along with some things to watch out for when considering binding rules.

The book then moves on to object prototypes kicking things off with a very good but concise Intro to Classes 101. The JS language doesn't exactly support classes but there workarounds that programmers have been using so Simpson describes them, their benefits and their drawbacks. Here things get a bit murky for me because although I have used classes with Delphi, years ago, I haven't written anything complex enough to need that in JS so I've avoided it. If this part of the book is the selling point for you then I think you'd do well to drop by a bookstore and spend a few minutes scanning those pages before buying. If you absolutely want to use or must use classes in JS then you should just get the book so you'll know its limitations without any varnish by class enthusiasts.
1 of 1 people found the following review helpful
5.0 out of 5 stars Required reading for programmers coming from class-based languages 6 May 2015
By S. Tang - Published on
I had an argument of sorts with a friend over the fact that ES5 JavaScript lacks native class-based paradigms. You see, his background is from class-based server side languages like Python and Java, so when he started tackling web development projects with JavaScript, he thought JavaScript was a deeply flawed language. Kyle Simpson's book (and his whole You Don't Know JS series) should be required reading for these types of programmers.

JavaScript was not originally designed to be a class-based language, but because it had objects and prototypes, I think a lot of developers trained in class-based languages just assumed that JavaScript would behave similarly to other class-based languages. Then, when things didn't work as they expected, they either criticized JavaScript as a flawed language or created libraries to shoehorn class functionality into JavaScript. Even with these polyfill libraries, class-based behavior was not perfect.

This particular book will inform you about how JavaScript objects and prototypes really work. It is not a flaw that JavaScript (ES5) lacks the class paradigm. It just tackles the problem space in a different, yet equally valid way. In some cases, having training in class-based languages can actually make learning JavaScript harder. A summarized nugget I learned from the book: stop thinking about JavaScript objects and prototypes as a top-down inheritance chain. Think of JavaScript objects and prototypes as "objects linked to other objects" with "delegation behavior" (Kyle's words). This is a side-to-side chain with a linked list type of behavior. Once you understand what Kyle is teaching in this book, you should hopefully appreciate or at least respect JavaScript's approach. If you really feel the class-based paradigm is the way to go, you can either wait for class support in JavaScript ES6 or use small libraries like TypeScript.

I'm glad that Kyle wrote this book, as it clarified my understanding of Javascript objects and prototypes and made me realize that the class paradigm is not the end all, be all design philosophy. Thanks, Kyle!
Were these reviews helpful?   Let us know
Search Customer Reviews

Customer Discussions

This product's forum
Discussion Replies Latest Post
No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
First post:
Prompts for sign-in

Search Customer Discussions
Search all Amazon discussions

Look for similar items by category