Most asked Javascript interview questions #shorts #javascript #react #coding

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

Рекомендации по теме
Комментарии
Автор

Ask the interviewer if this is the type of code they use, and if so - just go away(). And by the way, just replace var with let and you don't need the closure anymore

aram
Автор

Within the loop a REFERENCE to i is passed to the anonymous function. The 2 cycles of the loop passed in less then 1 second and loop is left. The i has the value 2 and both function calls print the value 2.

hugochavez
Автор

Interesting😍..Please post this type of interview questions!!

cutebaby_richu
Автор

This is not closure, by calling a different function you are basically creating a copy of the argument passed to that function (here i).

kartik
welcome to shbcf.ru