Why does the { position affects this Javascript code?

前端 未结 5 1373
夕颜
夕颜 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:21

    Javascript has some strange bits to it and one is that the position of the brackets matters - keep the opening one on the same line as the code

    http://encosia.com/in-javascript-curly-brace-placement-matters-an-example/

提交回复
热议问题