Skip to content

Instantly share code, notes, and snippets.

@ORESoftware
Created June 11, 2025 02:14
Show Gist options
  • Save ORESoftware/570e39044a09c0b1f4e4947576dd4940 to your computer and use it in GitHub Desktop.
Save ORESoftware/570e39044a09c0b1f4e4947576dd4940 to your computer and use it in GitHub Desktop.
the closure example was not correct
let i = 0;
const v = () => {
setInterval(() => {
console.log({i});
}, 200);
setInterval(() => {
i++;
}, 900);
}
v();
// you will see i increases with logging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment