Skip to content

Instantly share code, notes, and snippets.

@aidan-harding
Created June 15, 2021 08:09
Show Gist options
  • Save aidan-harding/5e590ba6b6d04e723603e0c98ac7a2a4 to your computer and use it in GitHub Desktop.
Save aidan-harding/5e590ba6b6d04e723603e0c98ac7a2a4 to your computer and use it in GitHub Desktop.
function sleeper(value) {
return new Promise(resolve => setTimeout(() => resolve(value), value * 100));
}
[5, 4, 3, 6, 1].forEach((value) => sleeper(value).then((value) => console.log(value)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment