JavaScript Operators

please click here for more wordpress cource

JavaScript operators are symbols or keywords used to perform operations on variables, values, and expressions. Here are some of the commonly used JavaScript operators:

  1. Arithmetic Operators: These are used to perform arithmetic calculations on numeric values. The arithmetic operators include + (addition), – (subtraction), * (multiplication), / (division), % (modulus), ++ (increment), and — (decrement).
  2. Comparison Operators: These are used to compare values and return a Boolean value (true or false). The comparison operators include == (equal to), === (equal to and of the same type), != (not equal to), !== (not equal to or not of the same type), > (greater than), < (less than), >= (greater than or equal to), and <= (less than or equal to).
  3. Logical Operators: These are used to combine multiple conditions and return a Boolean value. The logical operators include && (and), || (or), and ! (not).
  4. Assignment Operators: These are used to assign values to variables. The assignment operators include = (assignment), += (addition assignment), -= (subtraction assignment), *= (multiplication assignment), /= (division assignment), and %= (modulus assignment).
  5. Bitwise Operators: These are used to perform bitwise operations on binary numbers. The bitwise operators include & (AND), | (OR), ^ (XOR), ~ (NOT), << (left shift), and >> (right shift).
  6. Conditional (Ternary) Operator: This is a shorthand way of writing an if-else statement. The syntax is condition ? expression1 : expression2. If the condition is true, expression1 is executed. If the condition is false, expression2 is executed.
  7. Typeof Operator: This is used to check the data type of a variable or expression. The syntax is typeof variable. This will return a string indicating the data type, such as “string”, “number”, “boolean”, “undefined”, “function”, or “object”.

These are some of the most commonly used operators in JavaScript.

You may also like...

Popular Posts

Leave a Reply

Your email address will not be published. Required fields are marked *