Welcome to WebmasterWorld Guest from 18.104.22.168
Forum Moderators: open
Depending on your editor, it may not be clear otherwise if you actually have a line break in there (ending the line of code). Instead, your editor may just be wrapping the line visually. So without the semicolon, you can make and overlook errors more easily.
Practically speaking, it is not needed in most cases. The browser can usually parse statements based on new-lines, line-breaks and other informal conventions.
It is a good idea to put it anyways, though, because for example, a person may have the option to use strict JS in Mozilla turned on, and they might get syntax warnings in the console without it.
Also, in certain cases (e.g., in a bookmarklet) the lack of the semicolen may cause the evaluation of the statement to fail because there is no new-line or space or line-break between two statements (e.g.,
var a="Henry the ",b=7;++b;alert(a+b+"th\nI am, I am...");
Some parsers need the semicolon or you get an error because it runs the to statements together.