Can you please suggest me what to do after that to work in good js stack
— There is a udemy course I purchased guys clear all the doubts very well
— Wrong reply :P
— Please give me the link.
— Does this make sense to anyone? Please, explain Because print is not supposed to see increase, set and decrease. If number is changed in set, shouldn't it be seen only by set? Besides, what is for loop doing there?. How is print able to see for loop? The topic is closure
— It makes total sense. A function saves its context. In this case, number is available only by these functions. When you use manager it modifies global variables that store the functions. All of the four functions share the same context. For loop is calling increase each loop, having no curly braces is the same as having a single line block of code.
— Set function is not using any declaration statement, so that assignation is looking for the closest variable in the scope. So no, any change made by set function will be visible to any of the other functions.