You Don't Know JS: Scope & Closures
Publisher: O'Reilly Media
Final Release Date: March 2014
Pages: 98

No matter how much experience you have with JavaScript, odds are you don’t fully understand the language. This concise yet in-depth guide takes you inside scope and closures, two core concepts you need to know to become a more efficient and effective JavaScript programmer. You’ll learn how and why they work, and how an understanding of closures can be a powerful part of your development skillset.

Like other books in the "You Don’t Know JS" series, Scope and Closures dives into trickier parts of the language that many JavaScript programmers simply avoid. Armed with this knowledge, you can achieve true JavaScript mastery.

  • Learn about scope, a set of rules to help JavaScript engines locate variables in your code
  • Go deeper into nested scope, a series of containers for variables and functions
  • Explore function- and block-based scope, “hoisting”, and the patterns and benefits of scope-based hiding
  • Discover how to use closures for synchronous and asynchronous tasks, including the creation of JavaScript libraries
Product Details
About the Author
Colophon
Recommended for You
Customer Reviews

REVIEW SNAPSHOT®

by PowerReviews
oreillyYou Don't Know JS: Scope & Closures
 
4.4

(based on 26 reviews)

Ratings Distribution

  • 5 Stars

     

    (15)

  • 4 Stars

     

    (9)

  • 3 Stars

     

    (0)

  • 2 Stars

     

    (2)

  • 1 Stars

     

    (0)

92%

of respondents would recommend this to a friend.

Pros

  • Easy to understand (22)
  • Helpful examples (20)
  • Well-written (19)
  • Accurate (18)
  • Concise (18)

Cons

No Cons

Best Uses

  • Intermediate (21)
  • Novice (12)
  • Expert (11)
  • Student (9)
    • Reviewer Profile:
    • Developer (23)

Reviewed by 26 customers

Sort by

Displaying reviews 1-10

Back to top

Previous | Next »

 
5.0

You now know JavaScript

By Morhys

from London

Verified Reviewer

Pros

  • Accurate
  • Can Read Book In Bed
  • Concise
  • Easy to understand
  • Well-written

Cons

    Best Uses

    • Expert
    • Intermediate
    • Novice
    • Student

    Comments about oreilly You Don't Know JS: Scope & Closures:

    Get it now it will make you a better javascript developer, its that simple.

    (1 of 1 customers found this review helpful)

     
    5.0

    If you do JavaScript, go ahead and read

    By Modest Developer

    from Finland

    About Me Developer, Maker

    Verified Reviewer

    Pros

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

    Cons

      Best Uses

      • Expert
      • Intermediate
      • Novice
      • Student

      Comments about oreilly You Don't Know JS: Scope & Closures:

      If you read or write JavaScript, your life will become much easier after reading this series.
      I read this book series from back to back, not missing a single page. As it gets only better!

      I picked JavaScript by using it, so I had lots of holes in my understanding. This made it difficult to absorb new things about it. This book filled all the holes, and now I feel like I know some JavaScript.

      (3 of 3 customers found this review helpful)

       
      5.0

      A behind the scene look at JavaScript.

      By redrum

      from Montreal, Quebec, Canada

      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: Scope & Closures:

        After watching a movie I've enjoyed, I'm left wanting more so I watch the Special Features.

        With JavaScript, I feel this way; I enjoy using it - and I think I know how to use it pretty well - but I want more. This book to me is just like the "Special Features"; you don't have to watch it, but if you want more, there it is. And it's really enjoyable.

        As I've hinted at, this book is NOT a must to know how to code well. But if you're not satisfied to mechanically apply rules you've learned by heart and you want to better your knowledge and go from intermediate to expert and beyond, this is the book. Well this is "a" book in a series of books :)

        (3 of 3 customers found this review helpful)

         
        5.0

        The BEST JS book I have ever read!

        By Chet Harrison

        from Newport Beach, CA

        About Me Developer

        Pros

        • Easy to understand
        • Helpful examples

        Cons

          Best Uses

          • Expert
          • Intermediate

          Comments about oreilly You Don't Know JS: Scope & Closures:

          I have been writing JS on and off for 20 years and only seriously went after web app dev about a year ago. In this book, the depth of detail on how the mechanics of the language are actually resolved under the hood is astonishing. The rampant classical OO "abuse" of the language is the most telling indication of how little seasoned devs really understand it. One word of caution. READ THE WHOLE BOOK. The most valuable bits are in chapter 6 near the end of the book. I don't care if your the tech lead at Google or Brendan Eich himself, your really do need to read this book. Well OK maybe Brendan doesn't need to but probably has.

          (3 of 3 customers found this review helpful)

           
          5.0

          Great book overall

          By Jas

          from Southern California

          About Me Developer

          Verified Buyer

          Pros

          • Easy to understand
          • Helpful examples
          • Well-written

          Cons

            Best Uses

            • Intermediate
            • Novice
            • Student

            Comments about oreilly You Don't Know JS: Scope & Closures:

            I really enjoyed how this book was written. What I like best is that he's focusing on small chunks of the language that have typically caused huge amounts of confusion for new JavaScript developers rather than trying to cram in a whole overview of the language.
            Its a quick read and because of that I recommend it to just about everyone even if you think you have a pretty good handle on Scope and Closures.

            (2 of 3 customers found this review helpful)

             
            4.0

            Concepts you don't know you already use

            By Ken H

            from Australia

            About Me Developer

            Verified Reviewer

            Pros

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

            Cons

              Best Uses

              • Intermediate
              • Novice

              Comments about oreilly You Don't Know JS: Scope & Closures:

              Javascript has a number of features that can seem almost mystical to some developers, including the two concepts covered here, but they really aren't as elusive as some might think.

              This book assists in showing just how intrinsic scopes and closures are to the way we already code whether you know it or not, and will provide a good basis for recognizing how and when you use them, and allow you to take it a step further to openly and knowingly leverage the benefits they provide.

              While many of the code examples are contrived and have no real world usage, they do quickly and concisely prove the concepts they are aiming to prove and thus can't really be faulted for that.

              Unfortunately there is only a minimal coverage of Javascript's "this" despite that it is intrinsically tied to scope, which does make it feel like there is something missing (however "this" is covered in the next book in the series which also covers object prototypes, and may be just as appropriately placed there as it would have been in this book).

              (2 of 2 customers found this review helpful)

               
              4.0

              Good book even if you know JS

              By Mark T

              from Chicago, IL

              About Me Developer

              Verified Buyer

              Pros

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

              Cons

              • Short

              Best Uses

              • Expert
              • Intermediate
              • Novice
              • Student

              Comments about oreilly You Don't Know JS: Scope & Closures:

              The book provided some great clarification on the way JS works and more insight on Scopes and Closures.

              I would have liked a little more depth around some of the more complex applications and uses of scopes, but overall this book is a great, quick read with a lot of useful information.

              Definitely recommended.

              (3 of 3 customers found this review helpful)

               
              4.0

              Good stuff - other Good Stuff

              By The Gayngler

              from New York, NY

              About Me Developer

              Verified Reviewer

              Pros

              • Accurate

              Cons

              • Not comprehensive enough
              • Too concise

              Best Uses

              • Expert

              Comments about oreilly You Don't Know JS: Scope & Closures:

              While this book attempts to demystify javascript scope and closures for javascript developers, it makes the topic mildly less mysterious. After reading this book, I think the explanation of both topics feels unfinished. I may go and re-read this book again. It is like The Good Parts without the immediately good even if controversial ideas in it.

              The author rather than try to fit in a full discussion on scope and closures elects to put additional information into an appendix which takes the reader away from very relevant and related questions that would likely further the readers understanding of the subject matter without having to skip all over the place. Usually, I tend to think of an appendix as off topic, related and useful information rather than a way to artificially keep the chapters short.

              LHS/RHS scope explanation feels out of place being located in the first few chapters of this book. (Note: On some level I understand the logic of it being here.) Somehow I feel like its a complex theoretical topic being thrown at you right away before you have a solid context. The author probably could be more successful with explaining LHS/RHS scope by starting with day to day scoping problems developers have with their code now. Instead it comes off as too theoretical too fast and if you are not already well versed on compiler theory you can get lost right at the beginning of the book.

              The question becomes are we trying to explain scope to developers who do not understand scope or are we trying to sound smart to developers who probably already understand scope.

              The other thing I think is lacking with this book's explanation of scope is this and passing scope around and executing functions in a scope outside of their own. Giving a full and in depth explanation if this is immediately useful in solving problems developers have everyday.

              Lastly, the information on closures really only lasts for a chapter and then its really just a definition and showing off some common javascript patterns that closures rather than a full explanation of closures.

              Ive read other reviews claiming the length is a plus but I feel like I would have liked those 20 pages they shaved off this book back. My review comes off as negative despite my 3.75 star review because I strongly feel like it could have been a 5 star book. There is great explanations in this book minus other great explanations that were left out of this book.

              (1 of 1 customers found this review helpful)

               
              4.0

              A very focused and consice book, but...

              By NCA

              from France

              About Me Developer

              Verified Reviewer

              Pros

              • Accurate
              • Concise

              Cons

                Best Uses

                • Novice
                • Student

                Comments about oreilly You Don't Know JS: Scope & Closures:

                The "You don't known JS" collection aims at uncovering lesser known features of JavaScript programming paradigms. In that respect this book is a complete success the style is concise and the author always stays on topic.

                But in my opinion, there is a particular topic, tightly linked with "Scope and Closures" that has been left out and this has been a big disappointment to me.

                Nowhere is it talked about how JS implementations manage memory. As a matter of fact, if "Scope and closures" are a formidable tool, they really are the tricky part of the language. They let you build ever growing and complex memory graphs that are hard to get rid of (or hard to understand how they are managed). And as more and more JS apps are being written, I think it is a concern. By apps I mean programs that sits on the user's desktop, or on a backend server, and are used all work day long, without being reset or restarted. The tools are presented here, but there effect are not described in an explicit enough fashion for my taste. But maybe was I expecting too much of this little book ? And I know I am biased, having done lots of development in C. Yet garbage collection has its limit and making sure you understand what is going under the hood cannot hurt.

                Still, having seen in the workplace how little of javascript many developers know, this book is still of great value. Especially for developers new to JavaScript: it will let them learn things right from the get go, instead of having them to guess and learn things the hard way.

                (2 of 4 customers found this review helpful)

                 
                4.0

                Demythologizing Closures

                By ellmo

                from Poznań, Poland

                About Me Developer

                Verified Buyer

                Pros

                • Accurate
                • Concise
                • Easy to understand
                • Helpful examples

                Cons

                • Unnecessary References

                Best Uses

                • Intermediate

                Comments about oreilly You Don't Know JS: Scope & Closures:

                I bought this book for the sole purpose of finally trying to understand what exactly the mythical JavaScript closures are and what their relation is to scopes.
                I can't tell you how many times I've tried to grasp this concept with various online materials – but there always was something: either too few examples and too much theory, or just the opposite.

                At first I was disappointed with the low page count as I was expecting a thorough JavaScript programming manual. I then realized this small book (a booklet even) tackles only with the specified problem and does it extremely well, thanks to thought-out structure an extensive introduction to what scopes are – exactly what I needed.

                The only drawback (albeit minor) are the references and intercalations, which I sometimes found unnecessary.

                Displaying reviews 1-10

                Back to top

                Previous | Next »

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