2
Comments
  • 0
    @PublicByte yaa! Agreed!
    I had an argument on this with my mentor! So Hopefully it's under correct section!
  • 3
    They are optional, but you are then relying on the JS engine to insert them accurately for you.

    The compiler or engines job should be to compile you're code, not rewrite it so it actually works - but that's my opinion.

    99% of the time it will get it right and you will forgot about that 1%, but then you're going to bitch about that 1% for days when you do manage to have the compiler throw errors because you forgot the ; for that handful of places you actually needed it.

    Also, adding a semi colon at the end of the line is generally required by other languages. So for anyone who works across multiple languages it becomes pretty standard and habit to add them anyway.
  • 1
    @C0D4 They're only required in two places: before IIFEs and array/json literals.

    Personally I think JS looks cleaner without semis, but that's just personal preference.
  • 3
    @Root I don't mind JS without them, but it comes down to preference and since I jump between php, js, and java on a daily basis, the semi colon haunts me in most of my work 👻
  • 0
    I prefer semi-colons, but also don't really care and go with whatever the code standards are with the expectation I can lean into the linter for auto-fixing.
Add Comment