Statements
JavaScript works on sets of statements. These statements have an appropriate syntax where the syntax depends on what the statements contain. A statement can have multiple lines in it. Basically, a statement is a set of instructions given to a computer browser to execute JavaScript code. A statement can return a value that is terminated with a semicolon. A statement can be a call for a certain action, for example:
Document.Write("hello world");
The preceding statement calls the in-built Write()
function and prints the message hello world on the screen.
We can write multiple statements in one line separated by a semicolon; for example:
var a=20; var b=2;var c=a*b; document.write(c);
A statement can also be terminated with a line break, for ...
Get Web Developer's Reference Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.