Skip to content

Instantly share code, notes, and snippets.

@anuragkapur
Last active December 25, 2019 13:25
Show Gist options
  • Save anuragkapur/17426a23c922d66950c61001c52e811c to your computer and use it in GitHub Desktop.
Save anuragkapur/17426a23c922d66950c61001c52e811c to your computer and use it in GitHub Desktop.
JS Bin// source https://jsbin.com/lapuxoq
const myAlert = () => {
const x = "Foo Bar";
let count = 0;
const alerter = () => {
console.log(`${x} ${++count}`);
};
return alerter;
};
const funcAlert = myAlert();
const funcAlert2 = myAlert();
funcAlert();
funcAlert();
funcAlert2();
funcAlert2();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment