by wiseowise · 2y ago · 0 comments
> Other than that, functions should be defined by the keyword.
Says who?
const foo = () => {}
This function is not anonymous, it's called foo. const foo = () => {}
console.log( foo.name );
actually outputs 'foo', and not the empty string that I was expecting. const test = () => ( () => {} );
const foo = test();
console.log( foo.name );
outputs the empty string.Is this behavior required by the standard ?
var foo = function() {};
Except nowadays it too does have the name "foo".function foo(){} is also callable if bar is defined before foo.