Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. /**
  2. * the value will be all 2 , but if you change into *let*. that will not be happend
  3. **/
  4.  
  5. let callbacks = [];
  6. for(var i=0;i < 2; i++){
  7. callbacks.push(() => {
  8. console.log(i);
  9. });
  10. };
  11.  
  12. callbacks.forEach((callback) => callback());
  13.  
  14. const aFunction = () => {
  15. console.log('a function');
  16. };
  17.  
  18. aFunction();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement