JavaScript provides a variety of operators that are used to perform operations on values, manipulate data, and make comparisons. Here are some commonly used operators in JavaScript:
1. Arithmetic Operators:
- Addition: `+`
- Subtraction: `-`
- Multiplication: `*`
- Division: `/`
- Remainder (Modulus): `%`
- Increment: `++`
- Decrement: `--`
2. Assignment Operators:
- Assignment: `=`
- Addition assignment: `+=`
- Subtraction assignment: `-=`
- Multiplication assignment: `*=`
- Division assignment: `/=`
- Remainder assignment: `%=`
3. Comparison Operators:
- Equal to: `==`
- Not equal to: `!=`
- Strict equal to: `===`
- Strict not equal to: `!==`
- Greater than: `>`
- Less than: `<`
- Greater than or equal to: `>=`
- Less than or equal to: `<=`
4. Logical Operators:
- Logical AND: `&&`
- Logical OR: `||`
- Logical NOT: `!`
5. Unary Operators:
- Unary plus: `+`
- Unary negation: `-`
- Increment: `++`
- Decrement: `--`
6. String Operator:
- Concatenation: `+` (used to concatenate strings)
7. Conditional (Ternary) Operator:
- The conditional operator `?` is used for short-circuit condition evaluation.
- Syntax: `condition ? expression1 : expression2`
8. Type Operators:
- Typeof: `typeof` (returns the type of a value)
- Instanceof: `instanceof` (checks if an object is an instance of a specific class)
These are just a few examples of the operators available in JavaScript. Operators allow you to perform mathematical computations, assign values to variables, compare values, and manipulate data in various ways. Understanding and utilizing operators is essential for performing calculations and implementing logic in JavaScript code.
Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.
We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc