Click on text below to jump to specific point in the video
Why is this useful?They have quite a bit of use cases - I will give you one.
Example: send request function
We start by assigning a requestID to a variable and use a jQuery ajax function. When successful, we do an alert.
This illustrates a good use of closures. You start a task and you want to specify something that happens when that task is done with stuff that is available to you when you start the task. Closures make that easy and readable.
Closures permeates the entire language.There are more use cases. When you use it a lot in your code you will really internalize it. Mozilla has a super useful page on closures on their site. Video outline created using VideoJots