A computer program is a list of “instructions” to be “executed” by a computer. In a programming language, these programming instructions are called statements.
This statement tells the browser to write “Hello Dolly.” inside an HTML element with id=”demo”:
The statements are executed, one by one, in the same order as they are written
Add a semicolon at the end of each executable statement:
When separated by semicolons, multiple statements on one line are allowed:
a = 5; b = 6; c = a + b;
On the web, you might see examples without semicolons.
Ending statements with semicolon is not required, but highly recommended.
The following lines are equivalent:
var person = "Hege"; var person="Hege";
A good practice is to put spaces around operators ( = + – * / ):
var x = y + z;