Closures in JavaScript
Andrew Burgess
•
1 min read
Understanding Closures
To recap the concepts outlined in the video, note that:
We covered the concept of variable scope. Specifically, we talked about the following two items:
- Global Scope is a variable with global scope is accessible everywhere.
- Local Scope is a variable with local scope is accessible only within a function body.
In Summary
Closure is what happens when we manipulate variable scope in our functions. We might do this either to make variable contents accessible where they would not otherwise be, or to protect a variable from unwanted access.
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.
Sign upHi! I'm Andrew Burgess, and I'm a connoisseur of all things programming.
I'm from near Toronto, Canada, and I've been fooling around with computers for nearly my whole life, both hardware and software. Right now, I'm finishing up a computer science degree. For almost a decade now, I've been playing around with over a dozen programming languages on several different platforms, from JavaScript to Java, from Ruby to Befunge. My favourite has always been JavaScript.
I've always enjoyed writing, so when I discovered Tuts+ in 2009, I was excited to start writing tutorials. Since then, I've been writing tutorials and producing screencasts for Tuts+. Right now, I'm a course instructor and I produce mostly JavaScript-related courses. Maybe you've seen Building a Web App from Scratch with Angular.js or Node.js from Scratch; that's me!
I've also written a few ebooks, like Getting Good with Git, Getting Good with JavaScript, and, more recently, Backbone.js Blueprints.
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.