Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sleep(ms) {
- return new Promise(resolve => setTimeout(resolve, ms));
- }
- async function test() {
- for (let i=1; i<=10; i++) {
- console.log('Taking a break...' + i);
- await sleep(1000);
- console.log('done');
- }
- }
- test();
Add Comment
Please, Sign In to add comment