JavaScript Syntax
JavaScript syntax is the set of rules that define a correctly structured JavaScript program.
JavaScript Literals
Literals are fixed values, not variables. The two most important types are:
- Numbers are written with or without decimals:
10.50,1001 - Strings are text, written within double or single quotes:
"John Doe",'John Doe'
JavaScript Variables
In a programming language, variables are used to store data values. JavaScript uses the var, let and const keywords to declare variables.
javascript
let x;
x = 6;JavaScript Operators
JavaScript uses arithmetic operators (+ - * /) to compute values:
javascript
(5 + 6) * 10JavaScript is Case Sensitive
All JavaScript identifiers are case sensitive. The variables lastName and lastname, are two different variables.
Test Yourself with an Exercise
How do you declare a JavaScript variable?