Getting Closure

"No matter where you go, there you are."

— Buckaroo Banzai

The purpose of this chapter is to explain how closures work in plain English and to give a few compelling examples in which the use of closures really improves the quality of your code. Along the way, you’ll also explore whether any of the improvements in ECMAScript 6 mean that closures will not need to be the Swiss army knife of JavaScript.

Like many others, I am a self-taught programmer. A little more than a decade ago, I was also a freshly minted Creative Director working in Los Angeles. I was employed by a large company and inherited a team of very bright ...

Get Expert JavaScript now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.