问题 This question already has answers here : Why let and var bindings behave differently using setTimeout function? [duplicate] (2 answers) Closed 2 years ago . I understand that let has block scope and var has functional scope. But I do not understand in this case, how using let will solve the problem const arr = [1,2,3,4]; for (var i = 0; i < arr.length; i++) { setTimeout(function() { console.log(arr[i]) }, 1000); } // Prints undefined 5 times const arr = [1,2,3,4]; for (let i = 0; i < arr