refactoring, modules

This commit is contained in:
Ilya Kantor 2019-02-26 18:48:08 +03:00
parent b8f6d96990
commit a16814aaf1
112 changed files with 484 additions and 1825 deletions

View file

@ -0,0 +1,14 @@
# Delay with a promise
The built-in function `setTimeout` uses callbacks. Create a promise-based alternative.
The function `delay(ms)` should return a promise. That promise should resolve after `ms` milliseconds, so that we can add `.then` to it, like this:
```js
function delay(ms) {
// your code
}
delay(3000).then(() => alert('runs after 3 seconds'));
```