CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Closures Capturing let

JavaScript code walkthrough · Question 9
hardFunctions

Code

Read carefully. What does this print?
1const fns = [];
2for (let i = 0; i < 3; i++) {
3 fns.push(() => i);
4}
5console.log(fns.map((f) => f()).join(","));

Your answer