➕exponentiation (**)
🚧 under construction
JS ⟩ operator ⟩ arithmetic ⟩ exponentiation (**)
(⭐ES2016) 👉 table of operators
a ** x // exponentiation** operator
precedence relative to the unary negation operator is not defined❗
explicitly use parentheses when mixing
-with**❗equivalent to Math.pow() (except
**also accepts BigInts)❗
replit:exponentiation (a ** n)
-3**2, // ⛔ SyntaxError
// ^^^^
// ⛔ SyntaxError:
// Unary operator used immediately before exponentiation expression.
// Parenthesis must be used to disambiguate operator precedence.
(-3) ** 2, // 9
-(3 ** 2), // -9⛔ possible errorrs
SyntaxError:... parenthesis must be used to disambiguate operator precedence❗
Math.exp() - returns e raised to the power of a number.
Last updated
Was this helpful?