Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Understanding Closures in JavaScript!
You have completed Understanding Closures in JavaScript!
Preview
Closures can be found in all sorts of places in the wild. In this video we'll explore a few of those places, and show an example of a common problem that can be solved with closures.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Even simple projects can depend
on several different libraries.
0:00
Such as jQuery, Moment.js, or Underscore.
0:02
Each of these libraries use closures
to prevent variable conflicts.
0:06
If they didn't, a lot of bugs
would emerge.
0:10
There's a pattern called the module
pattern, which is employed for
0:14
distributing JavaScript code.
0:17
Check out the treehouse
content on the module pattern
0:20
linked in the teacher's notes.
0:23
In the Express J.S., framework for
0:25
note, some middlewares offer
configuration using closures.
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up