Hi ,
I missed semicolons in some of the places in my javascript , but its not throwing error in any of the browsers. Do the : at the end needed for sure
Hi ,
I missed semicolons in some of the places in my javascript , but its not throwing error in any of the browsers. Do the : at the end needed for sure
If it's not throwing compiler errors, you should be fine. It's better that you do remember to use them all the time however, as some languages that you might get into such as objective-c are adamant about their use.
The concept is known as JavaScript Semicolon Insertion or "Automatic Semicolon Insertion". The blog post JavaScript Semicolon Insertion: Everything you need to know outlines it well in an understable manner using examples:
It evens digs into the official ECMAScript specification about the topic.
Javascript does something called "semicolon insertion" which means you can actually write code that omits the semicolon in certain places, and they'll basically be added for you when the code is parsed.
The rules around when this happens a little complex. For simplicity's sake, many developers simply pretend semicolon insertion doesn't exist.
Semicolon is not required for javascript programming nevertheless i advice you to use it, it makes your code more readable and is actually a good practice almos all cool Programming languages use it.
So take a stand and use it, its up to you now!!