Operators are the symbols between values that allow different operations like addition, subtraction, multiplication, and more.
The + operator adds two numbers.
1 + 2;
The - operator subtracts one number from another.
50 - 15;
The * operator multiplies two numbers. Notice it’s an asterisk and not the × symbol commonly used in math.
3 * 12;
The / operator divides one number by another. Notice it’s a forward slash and not the ÷ symbol commonly used in math.
12 / 4;
1 + 100 * 5;
If want more control over the order, that’s where the grouping operator comes in handy.
Adding the grouping operator to the previous example causes 1 + 100 to evaluate first.
(1 + 100) * 5;
The + operator can also concatenate strings, which is another way of saying it can add them together.
"news" + "paper";
The = operator assigns values. It’s used for setting the value of variables.