Expressions and operators
An expression is any valid set of literals, variables, operators, and expressions that evaluates to a single value. The value may be a number, a string, or a logical value.
For Instance, there are two types of expressions:
1. Those that assign a value to a variable,
2. Those that simply have a value. For example, X=9
Regarding operators there are three types of operators:
- Arithmetic: evaluates to a number, for example var x = 100 + 50;
- String: evaluates to a character string, for ex :βAliβ or β123β
- Logical: considered as true or false
Functions
When you write a code, you need to do repeat the same action in more than one place, so instead, you can use a function to wrap that code and reuse it
Java script provides many built-in functions for instance, alert() and console.log().
So when you need to declare a function you need to use function word followed by the name of the function for ex:
function square(number){
return number * number; }