Nest all content into snippets

This commit is contained in:
Angelos Chalaris
2023-05-07 16:07:29 +03:00
parent 2ecadbada9
commit 6a45d2ec07
1240 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,23 @@
---
title: Get function name
type: snippet
language: javascript
tags: [function]
cover: flower-portrait-5
dateModified: 2020-10-19T22:49:51+03:00
---
Logs the name of a function.
- 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
let m = functionName(Math.max)(5, 6);
// max (logged in debug channel of console)
// m = 6
```