Browse Source

add nodejs section

master
markuman 4 years ago
parent
commit
0d6c8d94c7
  1. 20
      til.md

20
til.md

@ -153,3 +153,23 @@ pipe into vs-code
compare open file to clipboard
workbench.files.action.compareWithClipboard).
# Nodejs
## sleep()
```
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
sleep(1000).then(() => console.log("after 1.5 seconds))
async function main() {
await sleep(20000)
console.log("do something after 20 seconds")
}
main()
```
Loading…
Cancel
Save