Skip to content

Instantly share code, notes, and snippets.

@YonatanKra
Last active January 5, 2020 14:55
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 YonatanKra/2626c532c9050971e34e5cba75bbab14 to your computer and use it in GitHub Desktop.
Save YonatanKra/2626c532c9050971e34e5cba75bbab14 to your computer and use it in GitHub Desktop.
function createAndCount() {
const counter = {
count: 0
};
const objs = new Array(1000).fill(null).map(new Demo(counter));
for (let i = 0; i < 1000; i++) {
for (let demo = 0; demo < 1000; demo++) {
const currBoom = objs[demo];
currBoom.setMe();
}
}
console.log(`Counter is: ${counter.count}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment