Operators

In programming there are 4 fundamental operations with data.

  1. Assignment: storing a data value in a variable

  2. Arithmetic: operators used for mathematical calculations

  3. Comparison: operators used to compare two values

  4. Logical: operators used to combine multiple Boolean values or assess the True or False aspects between multiple values

Assignment Operation

let name = "Mr. Park";

Assignment operation is a way to store a value into a labeled container called a variable.

Arithmetic Operation

SymbolOperators

+

Addition

-

Subtraction

*

Multiplication

**

Exponentiation

/

Division

%

Modulus (Division Remainder)

++

Increment

--

Decrement

Arithmetic operations all require two values (a left operand and a right operand) except for the increment and decrement operators.

// Arithmetic Examples:
let x = 10;
let y = 5;

console.log(x + y);
console.log(x - y);
console.log(x * y);
console.log(x / y);
console.log(x ** y);
console.log(x % y);

console.log(x++);
console.log(y--);

Comparison & Logical Operator

Comparison and Logical operators will be explained in a future lesson when we learn how to do decision making with programming.

Last updated