## DOM review

## Javascript Output

## Variables

- Storing Data
- Variable Names
- Variable assignments
- Assignment statements
- Using a variable
var name = prompt("What is your name?"); document.write(name); var date = Date(); document.write(date); var location = window.loation; document.write(location);

## Data Types

## Operators and Expressions

- Statements
- Expression
- Assignment Operators
Operator Example Value stored in x = x = 5 5 = y = 12 x = y 12 - Arithmetic Operators
Operator Example Value stored in x + x = 2 + 5 7 – x = 5 – 2 3 * x = 2 * 5 10 % x = 5 % 2 1 - More Operators
Operator Example Value stored in x ++ x = 5; 6 x++; — x = 12; x–; 11 += x = 2; x += 5; 7 - String Operators
Operator Example Value stored in x + x = “Hi” + “There” “HiThere” + x = “Hi” + 5 “Hi5” += x = “Hi” x += “There” “HiThere” - Boolean Operators
- We can also use operators to compare values
- Assume x = 12;
Operator Example Returns == x == 5 false == x == 12 true != x != 5 true - Assume x = 12;
Operator Example Returns > x > 12 false >= x >= 12 true < x < 12 false <= x <= 12 true - Assume x = 12;
Operator Example Returns… == x == “12” true `=`

x `=`

“12”false !=== x !=== 12 false

- Logical Operators