Why does the { position affects this Javascript code?

前端 未结 5 1370
夕颜
夕颜 2020-12-20 22:03

I spent a fair bit of time on this Javascript issue (you can tell I am a JS noob):

Take some well written Javascript code like this example of the Revealing Module P

5条回答
  •  粉色の甜心
    2020-12-20 22:25

    Because the ECMA standard section 12.9 states you can't have a new line between the return keyword and its expression.

        ReturnStatement :
           return ;
           return [no LineTerminator here] Expression ;
    

提交回复
热议问题