Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div>
- <code>
- <pre>
- const arr = [8, 11, 20, 25];
- for (var i = 0; i < arr.length; i++) {
- setTimeout(function() {
- console.log('Index: ' + i + ', element: ' + arr[i]);
- }, 3000);
- }
- </pre>
- </code>
- </div>
- <p>What will the above code output to the console?</p>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement