Goodreads helps you keep track of books you want to read.
Start by marking “You Don't Know JS: Scope and Closures (You Don't Know JS, #2)” as Want to Read:
You Don't Know JS: Scope and Closures (You Don't Know JS, #2)
Enlarge cover
Rate this book
Clear rating
Open Preview

You Don't Know JS: Scope and Closures (You Don't Know JS #2)

4.54  ·  Rating details ·  1,075 Ratings  ·  88 Reviews
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 yo ...more
Paperback, 98 pages
Published March 24th 2014 by O'Reilly Media (first published January 1st 2014)
More Details... edit details

Friend Reviews

To see what your friends thought of this book, please sign up.

Reader Q&A

To ask other readers questions about You Don't Know JS, please sign up.

Be the first to ask a question about You Don't Know JS

Community Reviews

(showing 1-30)
Rating details
Sort: Default
Jun 24, 2015 rated it it was amazing
Does a programming book get better than this? I don't think so.
Ilya Ivanov
Sep 21, 2015 rated it it was amazing
Marvelous book. Kyle deserves every cent received at Kickstarter.

The book is so concise, that it seems like every word is brushed until it shines, revealing the underlying truth about JavaScript and it's key differences from other languages.

Topics covered: scope, different types of scope, modules, IFFE, hoisting, closures, polyfilling. Code samples are short, intention revealing and very informative.

I've been through two books in this series and very thrilled to dive deeper into next books.

Dave Peticolas
Nov 22, 2015 rated it really liked it
What a great little book. This might be the first Javascript book I've managed to finish without having my eyes glaze over from the tedium. Modern technical books tend to lean far too much on how-to examples and not enough time on deeper explanations. This book focuses on one particular aspect of the language, scope rules and closures, and explains it in depth. The author understands how important well-crafted analogies and mental models are for achieving genuine understanding.
Jul 02, 2018 rated it really liked it
الكتاب الثاني من سلسلة أنت لا تعرف جافاسكربت
إن كنتَ تبحث عن كتاب تتعلم من خلاله جافاسكربت يمكنك قراءة مراجعتي لكتاب هيدفيرست هنا *

كما يبدو واضحًا من عنوانه يتناول هذا الكتاب مفهومي النطاق ودالات الإغلاق - إن صحّت الترجمة - بشكل مُعمق ومُثقف، مستندًا بالشرح
بشكل أساسي إلى الطريقة التي يعمل بها مترجم اللغة compiler ** والقواعد التي يتبعها في معرفة أين وكيف يمكن الوصول إلى المتغيرات والدوال التي يتم تعريفها.

يعرض المؤلف كذلك بعض الطرق التي تشيع بين مبرمجي جافاسكربت كنوع من خداع القواعد التي يتبعها ال
Aug 08, 2017 rated it it was amazing
Shelves: 2017
Bardzo fajna książką skupiona na konkretnych funkcjonalnościach JavaScript jakimi są zakresy oraz domknięcia. Ich dobra znajomość jest o tyle ważna, iż pozwoli nam napisać lepszy, wydajniejszy kod a także uniknąć różnego rodzaju błędów związanych z nie do końca oczywistym działaniem JavaScript. Tym bardziej jeśli jesteśmy programistami jakiegoś silnie typowanego języka typu C# czy Java w którym wiele rzeczy działa nieco inaczej. Gdy zdążyliśmy się do nich przyzwyczaić zderzenie z JavaScriptem mo ...more
Oct 27, 2015 rated it it was amazing
Shelves: non-fiction
Excellent book, which describes the subject to its full extent.
Heba Atallah
Oct 13, 2017 rated it it was amazing
Shelves: javascript
That's what I'm calling the perfect book
Apr 04, 2018 rated it really liked it  ·  review of another edition
Not a bad deep dive into scope & closures. I picked up a good amount along the way. I'd definitely supplement this with YouTube videos to follow up.
Jul 25, 2015 rated it it was amazing
Shelves: programming
Awesome book. Helped me gain a better understanding of Scope and Closures and clear up some misconceptions! Before reading this book i actually thought JavaScript is an interpreted language but learned it is in fact a compiled language but its different from other compiled languages because compilation does not happen well in advance rather just milliseconds before execution. I also liked his definition of a closure, 'Closure is when a function is able to remember and access its lexical scope ev ...more
Jun 03, 2015 rated it it was amazing
I needed something to explain scopes and closures to a Junior Dev I've started working with and mentoring recently. The usual examples and code samples weren't clicking, and I began to realize that, even for me, those old stand-by's weren't what actually got me to grock closure. I had to use the module pattern extensively before I really understood the concept at an intuitive level.

This book fills in what I needed experience to understand. It is concise, it is accurate, it is clear. You can't as
Joshua Isaac
Mar 19, 2015 rated it it was amazing
Shelves: programming
This book was a nice refresher of things I already knew, as well as a tidy introduction to some new syntax in EC6. I appreciated his coverage of IIFEs because that's syntax I'm always very confused about. This book was explicit in its scope (hah!) - it really didn't touch on much else besides scopes and closures - but it also didn't shy away from telling you about powerful language functions just because they are not nice to think about.
Robson Castilho
Dec 15, 2016 rated it really liked it
Shelves: software
Concepts such as lexical scopes, function and block scopes, closures, module pattern, IIFE and hoisting are all well explained with simple code examples. At the start, a very good intro about Javascript compilation process, its compiler and engine.
Additionally, some new ES6 features are presented in conjuction with pollyfill solutions for block scopes.
A very good book for those who wants to understand how JS works!
Jeff Richardson
Jun 09, 2014 rated it it was amazing
While I already considered myself somewhat of an expert when it came to scope and closure, I've read and heard Crockford talk about them a lot over the years, and Zakas books have a wealth of information on scope and closures as well I feel this book provided a new light on them. I'm a better Client Side Engineer for having read this book.
Sep 06, 2017 rated it it was amazing
Did you know JavaScript is actually a compiled language? You probably did not. This and many other mind-blowing discoveries is what you will find after reading this book.

I learned what I know about JavaScript the usual way: try something; see it failing; try something else; see it working, but not really understanding why; move on with life.

This book enlightens you with the inner workings of JavaScript, specifically with something you use at every single JavaScript snippet you write, scope. It
Jul 16, 2017 rated it it was amazing  ·  review of another edition
Excellent coverage over these topics. One part I appreciated so much was that these topics are rarely covered well in any learning book, but are covered very well here, with reference to other ways for a more complete understanding. Kyle tells us about dynamic scoping and highlights the potential pitfalls of an area that is a mixture ("this" which in one context operates with lexical scope and in another case operates with dynamic scope). For me, the real attraction was a good understanding of c ...more
Dec 03, 2017 rated it liked it
Perhaps not worthy of a stand-alone title. And don't really agree with all of the advices regarding let.

The author's advice is also contradictory in the spirit of the series which is to understand deeply and then use it correctly.

On the other hand, for let the recommended use is only for block scope and even then make it explicit with braces. Ahem, that's why you use the new keyword 'let'.

If your code breaks after replacing var with let, you weren't writing very clean code in the first place.
May 13, 2018 rated it really liked it  ·  review of another edition
I've puzzled through enough JavaScript to develop an intuitive sense of scope and closure. But the temptation is to never give it much thought in the name of churning out code that works. The reality is that "What is Closure?" is an incredibly common interview question for almost any tech screen and it pays to develop a vocabulary for discussing it.

The additional study of how to leverage an understanding of closure in one's code is invaluable. And clearly about to lead into a long discussion of
Preeti Yadav
I'm reading the entire series and this book is a let down to its predecessor, at least to me. I expected to understand a bit more than what was offered in this part of the series. Most of the times, I was "What? What was that again?". I'll try to give it one more read and maybe get something more out of it.
Steven Raspudic
Jun 22, 2017 rated it it was amazing
A clean no nonsense explanation of the concept of 'closure'. The concept has attained almost mystical status, but as the author makes clear, it's really only a by-product of lexical scoping rules. I've been programming for a while (and never is JS!) but felt like a learned something from this book. Recommended.
Oct 25, 2017 rated it really liked it
Learned a lot from this book, extremely good.

I rated it 4 stars because it would have been much more awesome if he went into Dynamic vs Lexical Scope a little deeper, it was a real struggle understanding that all on my own.
Ryan Day
Jul 12, 2017 rated it it was amazing
I've never read a book about JavaScript like this. Simpson puts aside everything you've learned about JavaScript over the years and digs into the spec to find out how the language really works. You Don't Know JS makes JavaScript feel like a new and exciting language again.
Jan 29, 2018 rated it liked it
I needed side resources to understand some of its points
Oct 04, 2017 rated it it was amazing
Excellent book!
Pankaj Phartiyal
May 10, 2017 rated it it was amazing
A must read for Javascript Developers
Apr 26, 2018 rated it it was amazing
Lucid explanation of JavaScript scope and closures. Highly recommended!
Nov 19, 2017 rated it it was amazing  ·  review of another edition
This book does a really good job at simply explaining some advanced concepts in Javascript. Highly recommend the entire series for anyone looking to improve their knowledge.
Annette Bowman
Jun 02, 2017 rated it really liked it
I like this series-- good explanations, only pick a manageable chunk of info to go over, etc.
May 05, 2018 rated it really liked it
i need to reread it to truly understand these things tbh
i think the book is a tiny too advanced for my noob js self
Łukasz Sroczyński
Mar 14, 2017 rated it it was amazing
There's not many books that that go so deep into mechanisms of language. Definitely it's series that everyone should read!
Oleksandr Golovatyi
Aug 07, 2017 rated it it was amazing
корисна кнжика для всіх, хто програмує на JavaScript
« previous 1 3 4 5 6 7 8 9 next »
There are no discussion topics on this book yet. Be the first to start one »
  • The Principles of Object-Oriented JavaScript
  • Programming JavaScript Applications: Robust Web Architecture With Node, HTML5, and Modern JS Libraries
  • Object-Oriented JavaScript
  • jQuery Cookbook: Solutions & Examples for jQuery Developers
  • Functional JavaScript: Introducing Functional Programming with Underscore.js
  • Even Faster Web Sites
  • Professional Node.Js: Building JavaScript Based Scalable Software
  • Html5: Up and Running: Dive Into the Future of Web Development
  • Mobile Design Pattern Gallery: UI Patterns for Mobile Applications
  • High Performance Browser Networking
  • Pro Git
  • Speaking JavaScript
  • Pro AngularJS (Expert's Voice in Web Development)
  • Professional PHP Programming
  • Simply JavaScript: Everything You Need to Learn JavaScript from Scratch
  • Modern PHP: New Features and Good Practices
  • Effective JavaScript: 68 Specific Ways to Harness the Power of JavaScript
  • Beginning Linux Programming

Goodreads is hiring!

If you like books and love to build cool products, we may be looking for you.
Learn more »
Kyle Simpson is an Open Web Evangelist from Austin, TX, who's passionate about all things JavaScript. He's an author, workshop trainer, tech speaker, and OSS contributor/leader.
More about Kyle Simpson

Other books in the series

You Don't Know JS (6 books)
  • You Don't Know JS: Up & Going
  • You Don't Know JS: this & Object Prototypes
  • You Don't Know JS: Types & Grammar
  • You Don't Know JS: Async & Performance
  • You Don't Know JS: ES6 & Beyond

Nonfiction Deals

  • Masters of the Air: America's Bomber Boys Who Fought the Air War Against Nazi Germany
    $15.99 $3.99
  • The Monster of Florence
    $10.99 $2.99
  • The Westies: Inside New York's Irish Mob
    $9.99 $1.99
  • April 1865 (P.S.)
    $11.74 $1.99
  • Jesus Is ______: Find a New Way to Be Human
    $7.99 $0.99
  • Scent of the Missing: Love and Partnership with a Search-and-Rescue Dog
    $17.99 $1.99
  • Lab 257
    $8.74 $1.99
  • How Not to Hate Your Husband After Kids
    $9.99 $2.99
  • Girl in the Woods: A Memoir
    $11.99 $1.99
  • The Power of When: Discover Your Chronotype--and the Best Time to Eat Lunch, Ask for a Raise, Have Sex, Write a Novel, Take Your Meds, and More
    $14.99 $2.99
  • The Last Lecture
    $10.99 $2.99
  • Love Wins: A Book About Heaven, Hell, and the Fate of Every Person Who Ever Lived
    $12.74 $1.99
  • Not Tonight, Honey: Wait 'Til I'm A Size 6
    $10.99 $1.99
  • The Defining Decade: Why Your Twenties Matter--And How to Make the Most of Them Now
    $11.99 $2.99
  • Heroes, Gods and Monsters of the Greek Myths
    $9.99 $1.99
  • Ladies of Liberty: The Women Who Shaped Our Nation
    $5.99 $1.99
  • The Ends of the World: Volcanic Apocalypses, Lethal Oceans, and Our Quest to Understand Earth's Past Mass Extinctions
    $12.99 $1.99
  • Feast: True Love in and out of the Kitchen
    $4.99 $1.99
  • The Last of the Doughboys: The Forgotten Generation and Their Forgotten World War
    $15.99 $1.99
  • Vaccinated: One Man's Quest to Defeat the World's Deadliest Diseases
    $10.99 $1.99
  • Troublemaker: Surviving Hollywood and Scientology
    $12.99 $2.99
  • An Appetite For Wonder: The Making Of A Scientist
    $7.99 $1.99
  • Letters of Note: An Eclectic Collection of Correspondence Deserving of a Wider Audience
    $27.99 $2.99
  • Waiter Rant: Thanks for the Tip-Confessions of a Cynical Waiter
    $8.74 $1.99
  • Dakota: A Spiritual Geography (Dakotas)
    $13.99 $1.99
  • Restless: Because You Were Made for More
    $7.49 $1.99
  • Fifth Avenue, 5 A.M.: Audrey Hepburn, Breakfast at Tiffany's, and The Dawn of the Modern Woman
    $10.24 $1.99
  • The Song of the Dodo: Island Biogeography in an Age of Extinctions
    $16.99 $2.99
  • Happiness: The Crooked Little Road to Semi-Ever After
    $13.99 $3.99
  • Man-Eater: The Life and Legend of an American Cannibal
    $5.99 $2.99
  • Living Well, Spending Less: 12 Secrets of the Good Life
    $9.99 $1.99
  • Pukka: The Pup After Merle
    $17.99 $1.99
  • Buddhist Boot Camp
    $11.99 $1.99
  • Flour: A Baker's Collection of Spectacular Recipes
    $21.99 $3.99
  • The Longest Day: The Classic Epic of D-Day
    $12.99 $3.99
  • The 7 Habits of Highly Effective People: Powerful Lessons in Personal Change
    $5.99 $1.99
  • Van Gogh
    $9.99 $1.99
  • Lost in the Cosmos: The Last Self-Help Book
    $9.99 $1.99
  • Church of the Small Things: The Million Little Pieces That Make Up a Life
    $9.99 $1.99
  • Woman's Worth
    $9.99 $1.99
  • Six Degrees: Our Future on a Hotter Planet
    $5.99 $1.99
  • Do the Work
    $4.99 $1.49
  • The Lost Tribe of Coney Island: Headhunters, Luna Park, and the Man Who Pulled Off the Spectacle of the Century
    $4.99 $1.99
  • I Suck at Girls
    $10.74 $1.99
  • Cesar's Way: The Natural, Everyday Guide to Understanding and Correcting Common Dog Problems
    $11.99 $3.99
  • The Beauty Myth: How Images of Beauty Are Used Against Women
    $14.99 $2.99
  • Band of Brothers: E Company, 506th Regiment, 101st Airborne from Normandy to Hitler's Eagle's Nest
    $12.99 $3.99
  • Peace Is Every Breath: A Practice for Our Busy Lives
    $9.49 $1.99
  • Savage Harvest: A Tale of Cannibals, Colonialism, and Michael Rockefeller's Tragic Quest for Primitive Art
    $14.99 $1.99
  • Londoners: The Days and Nights of London Now--As Told by Those Who Love It, Hate It, Live It, Left It, and Long for It
    $7.24 $1.99
  • The World's Last Night: And Other Essays
    $7.99 $1.99
  • A. Lincoln
    $13.99 $1.99
  • Tracks: One Woman's Journey Across 1,700 Miles of Australian Outback
    $17.99 $1.99
  • Daring to Drive: A Saudi Woman's Awakening
    $13.99 $1.99
  • Hell's Princess: The Mystery of Belle Gunness, Butcher of Men
    $5.99 $2.99
  • Life
    $11.99 $2.99
  • Seeing Further: The Story of Science and the Royal Society
    $13.24 $2.99
  • Grace, Not Perfection (with Bonus Content): Celebrating Simplicity, Embracing Joy
    $8.99 $1.99
  • The Promise and the Dream: The Untold Story of Martin Luther King, Jr. And Robert F. Kennedy
    $9.99 $1.99
  • Through the Eyes of a Lion: Facing Impossible Pain, Finding Incredible Power
    $9.99 $1.99
  • Why We Run: A Natural History
    $9.49 $1.99
  • Edgar Allan Poe: The Fever Called Living
    $5.99 $2.99
  • The Road to Jonestown: Jim Jones and Peoples Temple
    $12.99 $2.99
“Closure is when a function is able to remember and access its lexical scope even when that function is executing outside its lexical scope.” 2 likes
More quotes…