JavaScript INTERVIEW QUESTIONS: What is Closure?

preview_player
Показать описание

In this tutorial I will answer pretty common JavaScript question - What is closure?

Closures in JavaScript are considered to be an advanced topics but in fact it is easy - function that is returned by other function in JavaScript creates a closure.
Рекомендации по теме
Комментарии
Автор

Please suggest interesting and challenging questions that you were asked during interviews!

Bogdan_Stashchuk
Автор

I found your channel very helpful, keep uploading new tutorials

jakhongirs
Автор

My question is
why did I use closure function in JavaScript?

asimmohammed
Автор

to be a closure it has to access variable from a parent function?

Or better to be a closure it MUST have access to a variable that the outer scope doesn't hold the value any longer?

I was trying to make a function play with the a variable from the global scope but I noticed that it doesn't make it a closure.

Thanks

edgarsantos
Автор

What is the practical use case of closure?

arnabsaha