JAVASCRIPT

YDKJS: Scope and Closures Review

BCiriak • December 11, 2019

Book Details:

  • Title: Scope and Closures
  • Author: Kyle Simpson
  • Pages: 83
  • Released: March 2014
  • My book: Paperback from Amazon

About the author of YDKJS Series

So who is Kyle Simpson, the author of You Don’t Know JS series? In his own words “Kyle Simpson is an evangelist of the Open Web, passionate about all things JavaScript. He writes, speaks, teaches, and contributes to OSS.”

He has years of JavaScript experience and also plenty of experience teaching JavaScript.

If you wanna know more about Kyle, head to his website.

YDKJS Series

You don’t know JS is a JavaScript book series composed of 6 following books:
  • Up & Going (read Up & Going review)
  • Scope & Closures
  • this & Object Prototypes
  • Types & Grammar
  • Async & Performance
  • ES6 & Beyond

For me personally, the approach of breaking different topics down into couple of books works well. Reading and learning feels more granular, which I like. One book at a time.

Back to Scope and Closures.

Closure is probably one of the most feared JavaScript topics and its reputation is well deserved. It is very hard to understand closures, when you try to understand just closures.

Underlaying topic for understanding closures is JavaScript scope. First, one must understand scope and then it is much easier to grasp closures and Kyle knows this.

Scope is really the major topic of this book and for a good reason.

Summary: Scope and Closures

As I just stated, author talks about scope through 2/3 of the book, really trying to explain all the ins and outs of how scope works in JavaScript.

How compiler looks at scope, how they talk to each other, how does scope lookup work and so on.

Next, you’ll read and learn about all of the different kinds of scopes like lexical, block, function scope etc..

Finally, closures. With solid understanding of JavaScript scope, you will be ready to jump right onto the infamous closures.

Thanks to many great code examples throughout the book, both of the underlying topics of this book are really well explained and brought to the reader/student.

Review: Scope and Closures

Scope and Closures doesn’t start as your usual programming book with some kind of Hello World example or what kind of data types JavaScript offers. (Speaking of Hello world, have a look at “Hello world” with Node.js and Koa.js). This book as all the others go deep into why and how JavaScript behaves the way it does. When we understand that, we can write high quality code.

Even though Kyle is explaining topics like JavaScript compiling process, scope lookup etc., his writing style is very clear and easy to understand. Which is a great feat for writing books about programming.

Book features countless short examples to explain why is something the way it is.

"When something is hard to understand, that usually means we need better understanding of the underlying concepts."

When something is hard to understand, that usually means we need better understanding of the underlying concepts, e.g. we need deeper understanding of the topic.

Scope and Closures does just this, in depth explanation of hard to understand subjects like closures, by first ensuring we understand its foundation.

To reinforce the acquired knowledge, couple of quizzes are sprinkled throughout the book. No need for pen and paper or laptop to go over these.

I really believe that after reading this book carefully, paying attention to all of the concepts mentioned, reader will understand the two main topics of the book. How JavaScript scope and closures work.

Should you buy Scope and Closures?

As you might already know, I am a fan of the YDKJS JavaScript book series. For one reason only, to really understand JavaScript, these might be the best books to read.

As I wrote in the review of YDKJS: Up and Going, you can read the electronic version of Scope and Closures book here for free, which again, is insane from Kyle Simpson! Thank you to Kyle.

Of course, if you can buy the book, support the author by getting a copy, it smells good.

Conclusion/Review result

This book and the whole series is a must read for any serious JavaScript developer.

Probably the best book to understand JS Scope and the Closures boogyman.

  • My Rating: 10/10
Cow says bye!

Read More

JavaScript for loops background feature image

JavaScript

JavaScript *for* Loops

JavaScript *for loops* are essential part of the language itself. Learn how they work and go over some tips on how to improve your workflow when it comes to JS for loops.

What are web frameworks featured image

Web Frameworks

Web Frameworks, What are They?

Web frameworks are amazing tools. They help us build web and speed up our development. Many implement best practices of experienced teams of developers.

Featured image for 5 ways to install Node.js.

Node.js

5 Ways to Install Node.js in 2019

Learn about 5 common ways to install Node.js on your machine. Get into JavaScript development the right way.