Created
March 12, 2021 08:53
-
-
Save hachi8833/48106ac053a78300f27f0baec54a1966 to your computer and use it in GitHub Desktop.
Promise sample code 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function delay(t){ | |
return new Promise(function(resolve){ | |
return setTimeout(resolve, t) | |
}); | |
} | |
function logHi(){ | |
console.log('hi'); | |
} | |
delay(2000).then(logHi); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment