Skip to content

Instantly share code, notes, and snippets.

@renzhezhilu
Last active October 14, 2019 13:25
Show Gist options
  • Save renzhezhilu/da9f319b6e89c7d63adbc036de855d53 to your computer and use it in GitHub Desktop.
Save renzhezhilu/da9f319b6e89c7d63adbc036de855d53 to your computer and use it in GitHub Desktop.
[Promise起手] #Promise
function timeout(ms) {
return new Promise((resolve, reject) => {
setTimeout(resolve, ms, 'done');
});
}
async function f (){
let d = await timeout(100)
console.log('100After...')
}
timeout(100).then((value) => {
console.log(value);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment