JAVASCRIPT

Operators Overview


 

Operators are symbols in javascript that perform operations on operands, such as variables, values, or expressions. These operations can include arithmetic, assignment, comparison, logical, and more. Here's an overview of the various types of operators in JavaScript.

 

1. Arithmetic Operators

These operators perform arithmetic operations on numeric operands.

  • ‘+’ -> Addition operator
  • ‘- ‘ -> Subtraction operator 
  • ‘*’ -> Multiplication Operator  
  • ‘/’ -> Division Operator
  • ‘%’ -> Modulus Operator 
  • ‘++’ -> Increment Operator 
  • ‘- -' -> Decrement Operator

 

2. Assignment Operators

Assignment operators assign values to JavaScript variables.

 

  • ‘=’ -> Assignment Operators
  • ‘+=’ -> Addition assignment Operators
  • ‘-=’ -> Subtraction assignment Operators
  • ‘*=’ -> Multiplication assignment Operators
  • ‘/=’ -> Division assignment Operators
  • ‘%=’ -> Modulus assignment Operators

 

3. Comparison Operators

Comparison operators compare two values and return a Boolean value.

 

  • `==` -> Equality 
  • `===` -> Strict Equal 
  • `!=` ->Inequality 
  • `!==` -> Strict Inequality 
  • `>` -> Greater than 
  • `>=` -> Greater than or equal to 
  • `<` -> Less than 
  • `<=` ->Less than or equal to

 

4. Logical Operators

Logical operators are used to combine conditional statements.

 

  • && (Logical AND)
  • || (Logical OR)
  • ! (Logical NOT)

 

5. Other Operators

These operators serve other purpose in JavaScript.

 

  • ` . ` -> Member access
  • ` () ` -> Function call
  • ` [] ` -> Array element access
  • ` ?: ` -> Conditional
  • `, ` -> Comma
  • `typeof` -> Type identification
  • `delete` -> Delete a property from an object
  • `void` -> Evaluates an expression and returns undefined
     

Understanding and utilizing these operators effectively is crucial for writing JavaScript code efficiently and correctly.