You Don't Know JS: this & Object Prototypes
Publisher: O'Reilly Media
Final Release Date: July 2014
Pages: 174

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
Table of Contents
Product Details
About the Author
Recommended for You
Customer Reviews

REVIEW SNAPSHOT®

by PowerReviews
oreillyYou Don't Know JS: this & Object Prototypes
 
4.9

(based on 10 reviews)

Ratings Distribution

  • 5 Stars

     

    (9)

  • 4 Stars

     

    (1)

  • 3 Stars

     

    (0)

  • 2 Stars

     

    (0)

  • 1 Stars

     

    (0)

100%

of respondents would recommend this to a friend.

Pros

  • Well-written (8)
  • Concise (7)
  • Helpful examples (7)
  • Accurate (6)
  • Easy to understand (6)

Cons

    Best Uses

    • Intermediate (10)
    • Expert (5)
    • Novice (3)
    • Student (3)
      • Reviewer Profile:
      • Developer (9)

    Reviewed by 10 customers

    Sort by

    Displaying reviews 1-10

    Back to top

    (1 of 1 customers found this review helpful)

     
    5.0

    So happy to know much more... now!

    By laruiss

    from Paris, France

    About Me Developer

    Verified Buyer

    Pros

    • Accurate
    • Concise
    • Easy to understand
    • Helpful examples
    • Well-written

    Cons

      Best Uses

      • Expert
      • Intermediate

      Comments about oreilly You Don't Know JS: this & Object Prototypes:

      Really easy to read, just as in the first book (Scope & Closures), and pleasant to be taught quite complicated concepts with simplicity (and talent). I will surely buy the next one in the series... Ooops, already did!

      (1 of 1 customers found this review helpful)

       
      5.0

      More than just a javascript book...

      By The Gayngler

      from New York, NY

      About Me Developer

      Verified Buyer

      Pros

      • Accurate
      • Concise
      • Easy to understand
      • Helpful examples
      • Well-written

      Cons

        Best Uses

        • Expert
        • Intermediate
        • Novice
        • Student

        Comments about oreilly You Don't Know JS: this & Object Prototypes:

        '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.

        (1 of 1 customers found this review helpful)

         
        4.0

        well to fill gaps

        By Laurent

        from Bordeaux

        About Me Developer

        Verified Buyer

        Pros

        • Easy to understand
        • Well-written

        Cons

          Best Uses

          • Intermediate

          Comments about oreilly You Don't Know JS: this & Object Prototypes:

          With this book, I have learned two things that I didn't understand in Js :
          - heritage whith prototype
          - this keyword

           
          5.0

          totally worth ur time and money

          By mihneasim

          from EU

          About Me Developer

          Verified Buyer

          Pros

          • Easy to understand
          • Helpful examples

          Cons

            Best Uses

            • Intermediate
            • Novice
            • Student

            Comments about oreilly You Don't Know JS: this & Object Prototypes:

            I like his explanations. Suitable for any js apprentice.

             
            5.0

            Excellent coverage of a complex topic

            By Matthew

            from Des Moines, IA

            Verified Reviewer

            Pros

            • Concise
            • Helpful examples
            • Well-written

            Cons

            • Difficult to understand

            Best Uses

            • Expert
            • Intermediate

            Comments about oreilly You Don't Know JS: this & Object Prototypes:

            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 conception 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.)

            (0 of 1 customers found this review helpful)

             
            5.0

            Essential reading

            By Tom Dan

            from Ca

            About Me Developer

            Verified Buyer

            Pros

            • Accurate
            • Concise
            • Helpful examples
            • Well-written

            Cons

              Best Uses

              • Expert
              • Intermediate

              Comments about oreilly You Don't Know JS: this & Object Prototypes:

              Great book, highly recommended.

              (2 of 2 customers found this review helpful)

               
              5.0

              great explanation

              By Lewis

              from Berkeley, CA

              About Me Developer

              Verified Buyer

              Pros

              • Concise
              • Helpful examples

              Cons

              • Combative Tone

              Best Uses

              • Intermediate

              Comments about oreilly You Don't Know JS: this & Object Prototypes:

              I was pretty ignorant of inheritance and how 'this' works. This book got me up to speed, and now I'm using call, apply, etc in my code. The book has this idea called OLOO that I've found pretty useful, too.

              (1 of 2 customers found this review helpful)

               
              5.0

              Great Series Of Books

              By Don

              from Florida

              About Me Designer, Developer

              Verified Buyer

              Pros

              • Accurate
              • Concise
              • Well-written

              Cons

                Best Uses

                • Expert
                • Intermediate

                Comments about oreilly You Don't Know JS: this & Object Prototypes:

                This is the second in the series of "You Don't Know Js:". If you are interested in really knowing how JavaScript works, these books are for you.

                (1 of 1 customers found this review helpful)

                 
                5.0

                First class explanations

                By Pedro The Learning Machine

                from Pleasanton, CA

                About Me Designer, Developer, Educator

                Verified Reviewer

                Pros

                • Accurate
                • Concise
                • Easy to understand
                • Helpful examples
                • Immediately Applicable
                • Well-written

                Cons

                  Best Uses

                  • Intermediate
                  • Novice
                  • Student

                  Comments about oreilly You Don't Know JS: this & Object Prototypes:

                  The mysteries of Javascript's "this" explained for your grokking pleasure.
                  Also included are the new details in ECMA6 as they pertain to objects and their use.
                  If you're looking for a book that finally explains "this" and objects so that by the end you have no doubt in your mind about how these concepts operate in Javascript, read this and move on with your life.

                  (3 of 4 customers found this review helpful)

                   
                  5.0

                  Clears It All Up For Me

                  By Rob Simpson

                  from Warrenton, VA

                  About Me Developer

                  Pros

                  • Accurate
                  • Easy to understand
                  • Well-written

                  Cons

                    Best Uses

                    • Intermediate

                    Comments about oreilly You Don't Know JS: this & Object Prototypes:

                    Just as the first book did, this one made it very clear and easy to understand this and prototype. I enjoyed the read and how straight forward it was in helping to understand how and when to use. Great read

                    Displaying reviews 1-10

                    Back to top

                     
                    Buy 2 Get 1 Free Free Shipping Guarantee
                    Buying Options
                    Immediate Access - Go Digital what's this?
                    Ebook: $21.99
                    Formats:  DAISY, ePub, Mobi, PDF
                    Print & Ebook: $27.49
                    Print: $24.99