name anonymous functions on property assignments

a.d.bergi at a.d.bergi at
Tue Jul 28 20:21:28 UTC 2015

> a big concern for me is what to do about functions being passed around

Nothing happens to them. This feature is only about assignments where the right hand side consists of a function expression.

> var a = {};
> = function () {}
> // .name would be "foo"


> var b = {};
> =;
> // .name would be "bar"

No, the name would still be "foo". It doesn't change when the function already has a `.name`, and `` is not an anonymous function definition but a memberexpression.

> doThing(()=>{})
> // what is .name?

Nothing. There is no identifier hanging around the function expression. It's anonymous, and will stay so.

You see, no magic! :-)


More information about the es-discuss mailing list