at Code Fellows 102 class session
An Expression evaluates into (results in) a single value. 2 types of expressions: - Expression that assigns a value to a variable; - Expressin that uses 2 or more values to return a single value.
Operators allow to create a single value from one or more values:
- Assignment operators color = 'beige;';
- Arithmetic operators area = 3*2;:
- +;
- -;
- /;
- ++;
- --;
- % - divides 2 values and returns the remainder;
- Comparison buy = 3 > 5; (returns false);
- Logical operators buy = (5 > 3) && (2 < 4); (returns true);
- String operators greeting = 'Hi!';;
Functions let you group a series of statements together to perform a specific task.
*
var msg = 'blablabla';
var el = document.getElementById ('message');
el.textContent = msg;