iKHtW i Know How this Works JavaScript Closures

Опубликовано: 09 Август 2026
на канале: BAM
39
0

I Know How this Works: JavaScript Closures
This is the podcast episode on closures.

Below is the script for the video.

Hello and welcome to another episode of 'I Know How this Works'

Today we're going to discuss JavaScript: closures.

But before we do, I wanted to say hello and thank you

to my sponsors: AwesomeWebStore.com where you can find the lastest

Information on tech news how to online run your online business and how to automate your business.

ThatOneTee.com where you can find images and info on where to find the latest and freshest graphic tees and how to get your own graphic tee business up and running.

And our last sponsor 5-10.club where you can buy clothing at near wholesale prices

in quantities of 5 and 10. Check them out. They have a variety of colors. A lot of colors you won’t find at retail stores or other sites.

Now back to JavaScript closures. I Know How this Works and I am awefulBrown.

Closures can be very simple. There’s some trickiness to it. But basically the concept of closures is that the function that is inside of another function is a closure. And it has access to the parameters and variables defined outside of it.

Right so.

This function here is my closure (marking the function ‘yourMath’). And it has access to this variable (pointing to ‘num1’) and these parameters ‘a, b’ of function ‘myMath’.

And if you go through this whole function

‘yourMath’ will return num1 + a + b. And when I return ‘yourMath’, what I end up with is ‘10’.

(Writing on the board) So this is the integer 10.

Think of closures kinda like children or grandchildren. They pretty much own or have access to anything that is yours. Right. If it is your child, if you get a drink at a restaurant; the baby is gonna want a sip of that and the baby is gonna get a sip of that.

So closures, they have access to the variables above them and the parameters above them.

And there you go.

Again I am awefulBrown and this And I Know How this Works so that you will too. Thank you for the sponsors:

AwesomeWebStore.com, ThatOneTee.com, and 5-10.club.

And see you next time on ‘I Know How this Works’.

Sources:

funfunfunction
   • Closures - Part 5 of Functional Programmin...  
W3Schools
http://www.w3schools.com/js/js_functi...
Mozilla Developer Network
https://developer.mozilla.org/en-US/d...
JavaScript.isSexy
http://javascriptissexy.com/understan...

Sponsors:

AwesomeWebStore.com
@AweWS
ThatOneTee.com
@AweWS
5-10.Club
@5-10Club