Should I put a Semicolon (;) when I use onclick=“”

后端 未结 4 1267
深忆病人
深忆病人 2020-12-14 16:00

Should I put a Semicolon (;) when I use onclick=\"\"?

Click

or:

相关标签:
4条回答
  • 2020-12-14 16:16

    I prefer a semicolon. I know it is optional (as it is many times in JS), but I like to be uniform and it helps to alert the person that the statement is complete.

    0 讨论(0)
  • 2020-12-14 16:24

    The semicolon in this position, is valid, but not mandatory.

    0 讨论(0)
  • 2020-12-14 16:26

    It is good practice to include it, since if you decide to add other statements after the call, it is clear and easy to do so. However, the code will run either way.

    0 讨论(0)
  • 2020-12-14 16:34

    As an optional semicolon, it's a matter of taste.

    0 讨论(0)
提交回复
热议问题