๐๐ฆ ๐ข๐ฝ๐ฒ๐ฟ๐ฎ๐๐ผ๐ฟ๐ ๐๐ ๐ฝ๐น๐ฎ๐ถ๐ป๐ฒ๐ฑ
Operators are symbols in JavaScript. They help you change values.
Math operators:
- adds values.
- subtracts values.
- multiplies values.
- / divides values.
- % gives the remainder.
- ** calculates power.
Assignment operators:
- = sets a value.
- += adds to a value.
- -= subtracts from a value.
Comparison operators:
- == compares values.
- === compares values and data types.
- != checks if values differ.
- !== checks if values or types differ.
Use === to avoid errors.
Logical operators:
- && needs all conditions to be true.
- || needs one condition to be true.
- ! flips the boolean value.
Increment and decrement:
- a++ adds 1.
- a-- removes 1.
Watch for type changes:
- "5" + 5 results in "55".
- "5" - 5 results in 0.
- true acts as 1.
- false acts as 0.
Source: https://www.geeksforgeeks.org/javascript/javascript-operators/ Optional learning community: https://dev.to/annapoo/how-does-increment-and-decrement-work-in-js-46hi