Javascript has various kinds of operators, in the following I will describe some of the types of operators, along with their demos.
Assignment Operators
Assignment Operator is an operator that assigns a value to the variable on the left
example:
const a = 20;
Then variable a will be 20
Please try:
Arithmetic Operators
In making applications, we will definitely meet with calculations for data calculations, as well as calculations for making animations and so on. Here I provide a cheat sheet or a cheat sheet that will probably be used very often.
Cheat Sheet (Cheat)
Operators | Explanation |
+ | Sum |
- | Reduction |
* | Multiplication |
/ |
Divide |
** | Exponential |
++ | Increment (increment) |
-- | Decrease (decrement) |
% | Modulus |
Please try, don't forget to open the console
Combination of Assignment Operator with Arithmetic Operations
Assignment operators can be combined with arithmetic operations. I include the cheat sheet
Cheat Sheet (cheat sheet)
Operators | Example | Same as |
+= | x += y | x = x + y |
-= | x -= y | x = x - y |
*= | x *= y | x = x * y |
/= | x /= y | x = x / y |
%= | x %= y | x = x % y |
**= | x **= y | x = x**y |
Practice
Good luck.