What is Closure in JavaScript?

preview_player
Показать описание
Codesmith Alum, Helen breaks down what closure is in JavaScript! #javascript #coding #code
Комментарии
Автор

Up until now I was sure a function which returns a function is a quantum operator

zxzxzzxx
Автор

there is a similar consept in functional languages called partial application ( which would be more mathematical definition than closure)

someone_
Автор

We can just check the same by saving it in a variable and simply use it in a function right? Then if it is mot used in this case. Could you make a video on closure actual use case rather than example case

eswarbalasubramanian
Автор

The example is showing the concept correctly, but the definition is not. A closure occurs when a function is CREATED in another function. The inner function can be stored somewhere and not necessarily returned. Similarly, functions being first class objects can be returned from a function, as a reference from somewhere else, in which case no closure is involved. So the statement "closure always occurs when a function returns a function" is not correct.

Автор

I understood the program but I don't understand closure concept 😢

jegadheeswarank
visit shbcf.ru