Skip to content

Instantly share code, notes, and snippets.

@rxluz
Last active June 22, 2019 17:09
Show Gist options
  • Save rxluz/1b699bb345625f013123fc8cf199146b to your computer and use it in GitHub Desktop.
Save rxluz/1b699bb345625f013123fc8cf199146b to your computer and use it in GitHub Desktop.
async function run() {
var test = {
value: 0,
};
const testss = await new Promise(accept =>
setTimeout(() => ((test.value = 90), console.log(test.value), accept()), 0),
);
async function testing() {
return Promise.all([...Array(10)].map((value, index) => {
return new Promise(accept =>
setTimeout(() => ((test.value = index), console.log(test.value), accept()), 0),
);
}));
}
var testt = await testing();
console.log(test.value, "test va1lue");
}
run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment