NEWBIE: Ending lines with a semicolon.

Giganews Newsgroups
Subject: NEWBIE: Ending lines with a semicolon.
Posted by:  varois… (Patrick)
Date: 6 Jul 2003


I am in the process of learning javascript.How come i am being told to
always finish my lines with a semicolon and when i try the 2 following
pieces of code they give the same output which is printing "Hello
world!" to the document.
The second example doesn't have the semicolon, why doesn't the browser
throw an error message?

<SCRIPT TYPE="text/javascript">
document.write("Hello world!"); //Semicolon present

<SCRIPT TYPE="text/javascript">
document.write("Hello world!") //Semicolon missing

Thanks to all

(Please answer here or email vaindio… and remove
NOSPAM.I don't read the address used to post.)