557 B
557 B
title, tags, expertise, cover, firstSeen, lastUpdated
| title | tags | expertise | cover | firstSeen | lastUpdated |
|---|---|---|---|---|---|
| Get function name | function | beginner | blog_images/flower-portrait-5.jpg | 2017-12-17T17:55:51+02:00 | 2020-10-19T22:49:51+03:00 |
Logs the name of a function.
- Use
console.debug()and thenameproperty of the passed function to log the function's name to thedebugchannel of the console. - Return the given function
fn.
const functionName = fn => (console.debug(fn.name), fn);
let m = functionName(Math.max)(5, 6);
// max (logged in debug channel of console)
// m = 6