Update snippet descriptions

This commit is contained in:
Isabelle Viktoria Maciohsek
2020-10-19 18:51:03 +03:00
parent f0fbe0c3e5
commit 5e8e6f51a3
36 changed files with 97 additions and 82 deletions

View File

@ -3,13 +3,13 @@ title: delay
tags: function,intermediate
---
Invokes the provided function after `wait` milliseconds.
Invokes the provided function after `ms` milliseconds.
- Use `setTimeout()` to delay execution of `fn`.
- Use the spread (`...`) operator to supply the function with an arbitrary number of arguments.
```js
const delay = (fn, wait, ...args) => setTimeout(fn, wait, ...args);
const delay = (fn, ms, ...args) => setTimeout(fn, ms, ...args);
```
```js
@ -20,4 +20,4 @@ delay(
1000,
'later'
); // Logs 'later' after one second.
```
```