Shorter syntax for arrow function assignment

T.J. Crowder tj.crowder at farsightsoftware.com
Wed Oct 25 14:20:42 UTC 2017


On Wed, Oct 25, 2017 at 3:11 PM, J Decker <d3ck0r at gmail.com> wrote:
>
> ya this is not a syntax error.
> myFn()
> {
> }

Indeed it isn't, but that isn't what I referred to in dante's message,
nor is it what he was suggesting it would be. He quoted

```js
myFn() {
}
```

...which is indeed a syntax error because ASI doesn't kick in. This:

```js
myFn()
{
}
```

...isn't a syntax error because ASI adds a `;` after `myFn()`, making
it a function *call* followed by a standalone block, not the function
declaration/expression he suggested it was.

All of which is by-the-bye, though, as I don't think Brian was
suggesting that anyway... :-)

-- T.J. Crowder


More information about the es-discuss mailing list