Javascript: Assignment Statements

Javascript statements usually terminate with a semicolon but the javascript engine may also determine that the statement is complete if it ends in a new line character. For example:


var aval = "hello"
var bval = "hello";

Are both valid. But, you should always end a statement with a semicolon. Don't depend on the Javascript engine to get it right every time, be explicit!

If multiple statements are on the same line they must end in a semicolon


var aval = "hello"; var bval = "hello";