On Fri, Nov 16, 2018 at 9:52 PM Tab Atkins Jr.
<[email protected]> wrote:
> ...while arrow functions are always name-less...

Minor nit-pick: Arrow functions are often named:

```js
const foo = () => {
    console.log(foo.name);
    throw new Error();
};
foo();
```
Fiddle: http://jsfiddle.net/1gpbvx06/

Running that, you'll see something like this in the console:

```text
foo
Uncaught Error
    at foo ((index):35)
    at (index):3
```

(Edge doesn't show the stack trace in the console, but if you step into
`foo`, it shows the proper name in the call stack.)

Search for SetFunctionName in the spec to find all the various places
anonymous function expressions (both traditional and arrow) assign names to
functions as of ES2015. (Basically: Anywhere the expression result is
assigned to a variable, constant, or default parameter value; or when it's
assigned to a property in an object initializer [but *not* when assigned to
a property on an existing object].)

</nit-pick> ;-)

-- T.J. Crowder
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to