Update snippet descriptions

This commit is contained in:
Isabelle Viktoria Maciohsek
2020-10-19 22:49:51 +03:00
parent 40a411f5b8
commit 920a0c390b
41 changed files with 94 additions and 81 deletions

View File

@ -5,12 +5,15 @@ tags: function,beginner
Logs the name of a function.
- Use `console.debug()` and the `name` property of the passed method to log the method's name to the `debug` channel of the console.
- Use `console.debug()` and the `name` property of the passed function to log the function's name to the `debug` channel of the console.
- Return the given function `fn`.
```js
const functionName = fn => (console.debug(fn.name), fn);
```
```js
functionName(Math.max); // max (logged in debug channel of console)
let m = functionName(Math.max)(5, 6);
// max (logged in debug channel of console)
// m = 6
```