Contents |
|
Using JavaScript | Variables |
JavaScript is a case sensitive programming language. An example keyword in JavaScript is var. Var will not be accepted. myName and MyName are different values.
Most lines of code start with a keyword or command, for example var, for or function.
Simple commands with single lines of code, end with a semicolon.
More complex commands require blocks of code. Blocks of code are surrounded by curly brackets. The commands for, while and if, all require blocks of code.
Code is treated as one line. So semicolons are the only way to know when one command ends and another starts. This code has two different commands, and is still valid on just one line.
Text should be surrounded by quotes. In JavaScript, text is called strings.
Arithmetic and mathematical formula can be calculated.
Some values have sub values and sub functions. These can be accessed by adding a point between the value and the sub value or function.
Using JavaScript | Variables |