0

In JavaScript if semicolon not present does the code get affected by without semicolon? What's the difference?

I tried but I didn't get error without semicolon.

28th Jan 2019, 5:13 PM
tejas
tejas - avatar
2 Réponses
+ 2
With semicolon you can write more than 1 expression in single line c=b;b=a;a=c; Without semicolon you need to seperate each expression by line c=b b=a a=c
28th Jan 2019, 5:50 PM
Taste
Taste - avatar
+ 2
But it is overally better to write them even when using linebreaks just to be sure. It could work without but when you do bigger projects it is frustrating when you have to put all missing semicolons in place becase it is not working.
28th Jan 2019, 9:02 PM
Maneren
Maneren - avatar