Last active
May 9, 2022 05:00
-
-
Save DavidSanwald/75f326cc1487d9463294dc19209d8fce 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