4.6.3. Order of Operations¶ code example
Example: 4.6.3. Order of Operations¶
/*Due to an historical quirk, an exception to the left-to-right rule
is the exponentiation operator **. A useful hint is to always use
parentheses to force exactly the order you want when exponentiation
is involved:*/
// the right-most ** operator is applied first
console.log(2 ** 3 ** 2)
// use parentheses to force the order you want
console.log((2 ** 3) ** 2)
//512
//64