Advertisement
Guest User

gooogle q

a guest
Nov 22nd, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. <div>
  2. <code>
  3. <pre>
  4. const arr = [8, 11, 20, 25];
  5. for (var i = 0; i < arr.length; i++) {
  6. setTimeout(function() {
  7. console.log('Index: ' + i + ', element: ' + arr[i]);
  8. }, 3000);
  9. }
  10. </pre>
  11. </code>
  12. </div>
  13.  
  14. <p>What will the above code output to the console?</p>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement