Skip to content

Latest commit

 

History

History
51 lines (43 loc) · 1.15 KB

operators.md

File metadata and controls

51 lines (43 loc) · 1.15 KB

Operators in JavaScript

JavaScript provides various types of operators to perform different operations. Here are some of the most commonly used operators:

Arithmetic Operators

  • + : Addition
  • - : Subtraction
  • * : Multiplication
  • / : Division
  • % : Modulus (Remainder)
  • ++ : Increment
  • -- : Decrement

Comparison Operators

  • == : 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

Logical Operators

  • && : Logical AND
  • || : Logical OR
  • ! : Logical NOT

Assignment Operators

  • = : Assignment
  • += : Addition assignment
  • -= : Subtraction assignment
  • *= : Multiplication assignment
  • /= : Division assignment
  • %= : Modulus assignment

Bitwise Operators

  • & : AND
  • | : OR
  • ^ : XOR
  • ~ : NOT
  • << : Left shift
  • >> : Right shift
  • >>> : Zero-fill right shift

Conditional (Ternary) Operator

  • condition ? expr1 : expr2

Type Operators

  • typeof : Returns the type of a variable
  • instanceof : Returns true if an object is an instance of an object type