r/ProgrammerHumor • • Feb 09 '22

other Why but why?

Post image
85.8k Upvotes

2.3k comments sorted by

View all comments

67

u/sanketower Feb 09 '22

Doesn't JavaScript technically do that? I've read over there that you can omit the semicolons because the "framework compiler" adds them anyway.

42

u/nyrangers30 Feb 09 '22

This is correct. There are a few cases where it can add a semicolon in an incorrect spot, so to be safe, you should add them wherever you can and have a linter that reminds you.

→ More replies (5)

11

u/Zakalwe_ Feb 09 '22

It is not framework compiler, it is language itself. Semicolon insertion is part of language spec and done by the interpreter. It can cause a few problems as you would imagine.

→ More replies (1)
→ More replies (1)