0
What happen if we miss semicolon after statement?
2 Antworten
+ 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).
+ 1
No error, Javascript can run without statement end with semicolon. Many Javascript programmers practise not put semicolon at the end of statements now.