JavaScript Comments

JavaScript comments can be used to explain JavaScript code, and to make it more readable. JavaScript comments can also be used to prevent execution, when testing alternative code. Single Line Comments Single line comments start with //. Any text between // and the end of the line will be ignored by JavaScript (will not be […]

JavaScript Syntax

JavaScript syntax is the set of rules, how JavaScript programs are constructed: var x, y;          // How to declare variables x = 5; y = 6;      // How to assign values z = x + y;         // How to compute values JavaScript Values The JavaScript syntax defines two types of values: Fixed values and variable values. Fixed values are called literals. Variable values […]

JavaScript Statements

Example var x, y, z;    // Statement 1 x = 5;          // Statement 2 y = 6;          // Statement 3 z = x + y;      // Statement 4 Try it Yourself » JavaScript Programs A computer program is a list of “instructions” to be “executed” by a computer. In a programming language, these programming instructions are called statements. A JavaScript program is a list of programming statements. In […]