Statements
Statements in JavaScript are usually terminated by a semicolon. A semicolon is not required but recommended.
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
<script type="text/javascript">
var firseName = 'firseName';
var thisIsAnotherVariable = 'this Is Another Variable';
document.writeln(firseName);
document.writeln(thisIsAnotherVariable);
</script>
</head>
<body>
</body>
</html>
Multiple statements can be combined into a code block by using C-style syntax({}):
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
<script type="text/javascript">
var i = 4;
if (i > 5){
alert("Greater than 5.");
} else {
alert("Less than or equal to 5.");
}
</script>
</head>
<body>
</body>
</html>