Created
November 27, 2018 01:31
-
-
Save talitaoliveira/ce6a7fc9b8f50a4a9da8492b43210a0c to your computer and use it in GitHub Desktop.
Using the new feature of ES7: Exponentiation Operator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* EXPONENTIATION OPERATOR | |
* - Is the same as Math.pow() | |
* - Don't need to use the library Math | |
*/ | |
// using Math library | |
let newNumber1 = Math.pow(4, 2); | |
console.log(newNumber1); // 16 | |
// not using Math library | |
let newNumber2 = 4 ** 2; | |
console.log(newNumber2); // 16 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment