jskatas.org Continuously Learn JavaScript. Your Way.

function API: function.name in depth

The name property is "descriptive of the function" the specification says.

in depth, special cases

WHEN binding a function THEN the bound-function's name gets prefixed with "bound"
const weBoundFn = (() => {}).bind(null); assert.equal(weBoundFn.name, 'bound ');
WHEN creating a Function instance THEN the name is "anonymous"
const fn = (new Function()).bind(null); assert.equal(fn.name, 'bound anonymous');

Links

The specification text, this property was introduced with this version of JavaScript.
The MDN pages describing this property, easy to read with examples.

Required Knowledge

Related Katas

function API

Arrow functions

Async Function

Difficulty Level

ADVANCED

Stats

2 tests to solve