Why does the Codecademy JavaScript editor not require the semicolon?

Today when I was using the Codecademy JavaScript editor, I slipped - and forgot the semicolon after one of my lines. But, when I ran the code, it came out with no errors. Is this the same in other editors, or is it just a glitch in the Codecademy editor. Maybe it is on purpose?

Hello, and welcome to the forums!

It isn’t a glitch with the editor. Semicolons are optional for the most part in JavaScript, but required in some scenarios and encouraged in others. Here’s an old blog post from Codecademy that still applies: Your Guide to Semicolons in JavaScript

I prefer to use them in the optional areas just for consistency

1 Like

Even though semi colons are optional in most cases, it is still a good practice to add semi colons after each expression (except for some cases mentioned in the article you recommend). This will help reduce the chances of getting errors

1 Like