File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
1-js/02-first-steps/08-operators Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -56,17 +56,21 @@ alert( 8 % 3 ); // 2, a remainder of 8 divided by 3
5656
5757### Exponentiation **
5858
59- The exponentiation operator ` a ** b` multiplies ` a` by itself ` b` times.
59+ The exponentiation operator ` a ** b` raises ` a` to the power of ` b` .
60+
61+ In school maths, we write that as a< sup> b< / sup> .
6062
6163For instance:
6264
6365` ` ` js run
64- alert( 2 ** 2 ); // 4 (2 multiplied by itself 2 times)
65- alert( 2 ** 3 ); // 8 (2 * 2 * 2, 3 times)
66- alert( 2 ** 4 ); // 16 (2 * 2 * 2 * 2, 4 times)
66+ alert( 2 ** 2 ); // 2² = 4
67+ alert( 2 ** 3 ); // 2³ = 8
68+ alert( 2 ** 4 ); // 2⁴ = 16
6769` ` `
6870
69- Mathematically, the exponentiation is defined for non- integer numbers as well . For example, a square root is an exponentiation by ` 1/2` :
71+ Just like in maths, the exponentiation operator is defined for non- integer numbers as well.
72+
73+ For example, a square root is an exponentiation by ½:
7074
7175` ` ` js run
7276alert( 4 ** (1/2) ); // 2 (power of 1/2 is the same as a square root)
You can’t perform that action at this time.
0 commit comments