𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗢𝗽𝗲𝗿𝗮𝘁𝗼𝗿𝘀 𝟭𝟬𝟭
JavaScript operators are symbols. Use them to change values. They help you build expressions.
Arithmetic Operators Use these for basic math.
- Plus (+): Adds numbers. It joins strings together.
- Minus (-): Subtracts numbers.
- Asterisk (*): Multiplies numbers.
- Slash (/): Divides numbers.
- Percent (%): Gives you the remainder.
Assignment Operators Use these to set values.
- +=: Adds to a value.
- -=: Subtracts from a value.
- *=: Multiplies a value.
- /=: Divides a value.
- %=: Finds the remainder. You chain these. Example: a = b = c. All variables get the same value.
Comparison Operators These return true or false.
- Greater than (>) or Less than (<).
- Equals (==). Strings use character codes. Use toLowerCase() for fair string checks.
Strict Equality Use === and !==. These do not change data types.
- "10" == 10 is true.
- "10" === 10 is false.
Source: https://dev.to/pdhanush26/operators-in-javascript-1nm2