Created
March 1, 2019 00:05
-
-
Save nguyenvanduocit/71adc2265a50eefb881b763514e7f8a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// interviewer: what will the following code output? | |
const arr = [10, 12, 15, 21]; | |
for (var i = 0; i < arr.length; i++) { | |
setTimeout(function() { | |
console.log('Index: ' + i + ', element: ' + arr[i]); | |
}, 3000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment