File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,36 @@ console.log('Division: x / y = ' + division); // Division: x / y = 2
81
81
82
82
> Why not try some other maths problem using the ` x ` and ` y ` variables?
83
83
84
+ #### More maths
85
+
86
+ Other basic but useful math operators are ` % ` , ` ** ` , ` ++ ` and ` -- ` :
87
+
88
+ > The modulus ` % ` operator returns the remainder when dividing one operand by another.
89
+
90
+ > The exponentiation ` ** ` operator returns the result of raising the first operand to the power of the second.
91
+
92
+ > The increment ` ++ ` and decrement ` -- ` operators return the result of adding one and subtracting one from an operand respectively.
93
+
94
+ ``` js
95
+ var x = 5 ;
96
+ var y = 3 ;
97
+ var modulus = x % y;
98
+
99
+ console .log (' Remainder: x % y = ' + modulus);
100
+
101
+ var exponentiation = x ** y;
102
+
103
+ console .log (' Exponentiation: x ** y = ' + exponentiation);
104
+
105
+ var increment = x++ ;
106
+
107
+ console .log (' Increment: x++ = ' + increment);
108
+
109
+ var decrement = y-- ;
110
+
111
+ console .log (' Decrement: y-- = ' + decrement);
112
+ ```
113
+
84
114
#### Comparisons
85
115
86
116
The ` === ` operator compares two values, it returns the boolean ` true ` if they are equal and ` false ` if they are not.
You can’t perform that action at this time.
0 commit comments