Why is the following a syntax error?
(()=>{console.log(1)}())
()=>{console.log(1)} is clearly(?) an expression that evaluates to a fat arrow function, and () "should" call it?
Presumably because it is ambiguous. What is the ambiguity?
Obviously, I realise the following works:
(()=>{console.log(1)})()
a = b = () => a = b = cis valid and has resolved ambiguity through precedence rules.a = () => b () () ()is the same - and equal toa = () => { return b()()(); }, not toa = (() => b)()()(). This is why() => { b() }is not allowed in that position either, even if an arrow function with a block body wouldn't be ambiguous.