01. Strings
Strings can be written with double or single quotes. You have used both in previous demos.
02. Statements
A JavaScript program is a list of statements to be executed by a computer.
- Declare 3 variables
- Assign the value 5 to x
- Assign the value 6 to y
- Assign the sum of x + y
- Document the statement by finding the div ID demo_01 and write the statement inside the HTML file.
- Finally, you document where the answer should show up, we are using demo_numbers for each example.
03. Variables
In this example, we declare the variables as words:
- Declare the variables price1, price2, and total
- Assign the value of 5 to price1
- Assign the value of 6 to price2
- Assign the sum of price1 + price2 to total
- Finally you document where the answer should show up, we are using demo_numbers for each example
04. Operators
The assignment operator (=) assigns a value to a variable. Other operators include signs such as, equal, plus, subtraction, multiplication, division, percentage and combinations of these signs.
- Assign the value 5 to x
- Assign the value 2 to y
- Assign the value x+y to z
- Finally, you document where the answer should show up, we are using demo_numbers for each example
05. Data Types
JavaScript evaluates expressions from left to right. Different sequences can produce different results.