Saturday, May 6, 2023

121: Javascript Challenge 2

 The second problem went deeper into the concept of closures. A function has access to any variable declared within its scope as well as any outer scope, which altogether constitute its lexical environment. By having a function that returns another function (a "factory function") this allows you to encapsulate data and can serve as a sort of state for your function. Function closure can achieve many of the same things as classes, but they are stored differently in memory. 

No comments:

Post a Comment

190: Sablier

 The CodeHawks platform has an upcoming audit on the Sablier protocol, so I decided to read through the docs and familiarize myself with the...