The React Show cover image

What Actually Happens When You Call A Function?

The React Show

00:00

How to Use Lexical Closures in JavaScript

Sally: Did you know that this style of storing function call frames in an environment data structure, like we talked about, is what enables lexical closures where you can return a function that refers to a variable that isn't exposed from the outer function? Sally: This allows you to do many really neat things. Like you can actually create your own, essentially, JavaScript, like classes without using the built-in class mechanism. Sally: Adding support for returning functions that can have lexical closures can mean massive changes to language implementations. Most non-garbage collected language implementations use the call stack to store all the variables values instead of storing it in a separate data structure which means those values are

Transcript
Play full episode

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app