Quiz · Closures and this · lesson 5 of 11
Quiz — var in a loop of functions
What does the program print?
const fns = [];
for (var i = 0; i < 3; i++) {
fns.push(() => i);
}
console.log(fns[0](), fns[1](), fns[2]());Subscribe to take the course
The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.