Files
30-seconds-of-code/snippets/log-function-name.md
Angelos Chalaris ede8c5932a Tag and build
2017-12-16 14:39:08 +02:00

9 lines
292 B
Markdown

### Log function name
Use `console.debug()` and the `name` property of the passed method to log the method's name to the `debug` channel of the console.
```js
const functionName = fn => (console.debug(fn.name), fn);
// functionName(Math.max) -> max (logged in debug channel of console)
```