Deep JavaScript Foundations: Why we have Closure and Modules?.
Автор: Eulier Gonzalez
Загружено: 2025-11-15
Просмотров: 30
Описание:
Working with variables is fundamental in programming, and where we put or variables, functions, and blocks relate to each other is defined by the Scope rules at compile time.
The resulting scope structure won't be modified by runtime conditions.
In JS, functions are values (A.K.A. 1st-class citizens), where we can define variables in it and it maintains the scope, no matter in which part of the program we call it. This is a Closure.
Closure allows us to "remember" variables that we need over time.
And to avoid some common problems like name collision, unintended dependencies, and unexpected behaviors, we avoid over-exposing variables as a way to organize our code and make it easy to understand and enhance the product.
So Closure enables us to organize our code like Modules.
A module is a collection of data and functionality divided into private and public details that we can expose.
A module is stateful; it keeps data and functionality over time, allowing access or updates to data.
https://docs.google.com/document/d/1X...
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: