Flat Preloader Icon

JS Operators

In JavaScript, operators are symbols that are used to perform operations on operands. Operands can be variables, values, or expressions. JavaScript supports various types of operators, including arithmetic, assignment, comparison, logical, bitwise, and more. Here’s a brief overview of some common types of operators in JavaScript:
  1. Arithmetic Operators: Used to perform mathematical operations.

    • + (Addition)
    • - (Subtraction)
    • * (Multiplication)
    • / (Division)
    • % (Modulus – returns the remainder of a division)
    • ++ (Increment)
    • -- (Decrement)
  2. Assignment Operators: Used to assign values to variables.

    • = (Assignment)
    • +=, -=, *=, /=, %= (Compound assignment)
  3. Comparison Operators: Used to compare values.

    • == (Equal to)
    • === (Strict equal to)
    • != (Not equal to)
    • !== (Strict not equal to)
    • > (Greater than)
    • < (Less than)
    • >= (Greater than or equal to)
    • <= (Less than or equal to)
  4. Logical Operators: Used to combine or manipulate boolean values.

    • && (Logical AND)
    • || (Logical OR)
    • ! (Logical NOT)
  5. Bitwise Operators: Used to manipulate the binary representation of numbers.

    • & (Bitwise AND)
    • | (Bitwise OR)
    • ^ (Bitwise XOR)
    • << (Left shift)
    • >> (Right shift)
    • >>> (Unsigned right shift)
    • ~ (Bitwise NOT)
  6. Conditional (Ternary) Operator: A shorthand for the if…else statement.

    • condition ? expr1 : expr2
  7. Typeof Operator: Used to determine the type of a variable or expression.

    • typeof
  8. Instanceof Operator: Used to check whether an object is an instance of a specific class or constructor.

    • instanceof

Share on: