0

What happen if we miss semicolon after statement?

29th Jun 2017, 8:08 AM
Bharati Raosaheb Sonawane
2 odpowiedzi
+ 2
Actually, it will not produce error. Not every single line of js code result error. e.g. <script type=javascript"> var a = true; if(a) document.write("A is true") else document.write("A is false") </script> That's code doesn't has semicolon and curly bracket. But it works (so far I tried). That code will display 'A is true' instead of produce error. BUT... It will cause error if we minified into the javascript file (single line of code).
29th Jun 2017, 8:31 AM
Fendi Septiawan
Fendi Septiawan - avatar
+ 1
No error, Javascript can run without statement end with semicolon. Many Javascript programmers practise not put semicolon at the end of statements now.
29th Jun 2017, 9:06 AM
Calviղ
Calviղ - avatar