Basic Operators

Introduction to JavaScript operators and where they are used.

Operators

In JavaScript, an operator runs an operation on single operand or multiple operands. One example of a commonly used operator is the assignment operator =.

These operators have various types and are placed differently in different situations.

Types of operators

There are five main types of operators in JavaScript:

  • Arithmetic operators
  • Comparison operators
  • Logical operators
  • Assignment operators
  • Conditional operators

Let’s see what each operator does.

Arithmetic operators

Arithmetic operators are operators that allow us to apply mathematical operations on numerical data operands.

All the arithmetic operators are below:

Operator Description
+ Addition Operator: This operator adds two numeric operands together
- Subtraction Operator: This operator subtracts the right operand from the left
* Multiplication Operator: This operator multiplies the two operands together
/ Division Operator: This operator divides the left operand by the value of right operand
% Remainder
...