throwif operator

Isiah Meadows isiahmeadows at gmail.com
Sat Apr 15 02:54:23 UTC 2017


I like the idea of throw expressions a lot, too. One area where it'd
be useful would be in arrow functions - I really don't enjoy the extra
4-5 characters just to throw an unconditional error from an arrow
function.

```js
// Done this a lot:
foo(...args, () => { throw new Error() })

// Much nicer:
foo(...args, () => throw new Error())
```
-----

Isiah Meadows
me at isiahmeadows.com


On Wed, Apr 12, 2017 at 3:11 AM, Нурбек <nurbek.ab at gmail.com> wrote:
> Yes, throw expressions would be helpful to shorten if statements to
> one-liner ternary operators. I agree with you.
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


More information about the es-discuss mailing list