The following code, when executed,
true && () => {}
yields
Uncaught SyntaxError: Malformed arrow function parameter list
Why ?
Edit: I know wrapping the function in parenthesis works, thanks everyone, but I'd like to understand why can't the parser figure out it's a function in the first place.
The reason is due the first part true || (a)
being parsed by itself and THEN the parser is trying to parse the rest => {}
, which causes the error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With