Skip to content

Instantly share code, notes, and snippets.

@anztrax
Created March 14, 2019 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anztrax/287d692b8a20de3f418b9f04daf82795 to your computer and use it in GitHub Desktop.
Save anztrax/287d692b8a20de3f418b9f04daf82795 to your computer and use it in GitHub Desktop.
/**
* the value will be all 2 , but if you change into *let*. that will not be happend
**/
let callbacks = [];
for(var i=0;i < 2; i++){
callbacks.push(() => {
console.log(i);
});
};
callbacks.forEach((callback) => callback());
const aFunction = () => {
console.log('a function');
};
aFunction();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment