Logo

Developer learning path

JavaScript

Operators in JavaScript

Operators

49

#description

JavaScript has various types of operators that allow us to perform different types of operations on variables and values.

Some of the commonly used operators in JavaScript are:

  1. Arithmetic Operators: Arithmetic operators are used to perform mathematical calculations like addition, subtraction, multiplication, division, modulus, increment, and decrement.
  1. Comparison Operators: Comparison operators are used to compare two values and return a Boolean (true or false) result. For example, equal to (==), not equal to (!=), greater than (>), less than (<), greater than or equal to (>=), and less than or equal to (<=).
  1. Logical Operators: Logical operators are used to combine multiple conditions and return a Boolean result. There are three logical operators, and they are && (logical AND), || (logical OR), and ! (logical NOT).
  1. Assignment Operators: Assignment operators are used to assign values to variables. For example, = (simple assignment), += (add and assign), -= (subtract and assign), *= (multiply and assign), /= (divide and assign), %=(modulus and assign) and so on.
  1. Bitwise Operators: Bitwise operators are used to perform bitwise operations on binary numbers. For example, & (bitwise AND), | (bitwise OR), ^(bitwise XOR), ~ (bitwise NOT), << (left shift), and >> (right shift).

Knowing and understanding these operators is important when it comes to writing efficient and effective JavaScript code.

March 25, 2023

If you don't quite understand a paragraph in the lecture, just click on it and you can ask questions about it.

If you don't understand the whole question, click on the buttons below to get a new version of the explanation, practical examples, or to critique the question itself.