Skip to content

Instantly share code, notes, and snippets.

@sarfarazansari
Created May 31, 2019 07:12
Show Gist options
  • Save sarfarazansari/ea046c7222fe427614522ab9cd140a31 to your computer and use it in GitHub Desktop.
Save sarfarazansari/ea046c7222fe427614522ab9cd140a31 to your computer and use it in GitHub Desktop.
// due to a classic closure problem
for (let i = 0; i < found.length; i++) {
setTimeout(() => {
found[i].time = + new Date();
// set values in db to see item in pinned list
}, i * 2000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment