Why do JavaScript statements have to end with a semicolon ";"? -


while writing js code front-end business project, wondered why have end js statements semicolon ?

so main use of semicolon in javascript ?

thanks answers.

';' mean end of code line , ';' can write js code in 1 line @ following example

alert("a")alert("b"); //this return error uncaught syntaxerror 

but

alert("a");alert("b");//this work fine 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -