TheDocumentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
** operator is the exponentiation operator in JavaScript. It evaluates to the result of raising the first operand (the base) to the power of the second operand (the exponent). It serves as the declarative, syntactic equivalent to the Math.pow() method.
Evaluation Mechanics
Associativity Unlike most arithmetic operators in JavaScript (which are left-associative), the** operator is right-associative. When multiple exponentiation operators are chained, the expression is evaluated from right to left.
ToNumeric abstract operation to both operands. If the operands are not already Numbers or BigInts, JavaScript will implicitly coerce them before evaluation.
Syntax Constraints with Unary Operators
JavaScript enforces a strict parsing rule to eliminate ambiguity regarding operator precedence between unary operators (such as+, -, ~, !, delete, void, typeof) and the exponentiation operator.
You cannot place a unary operator immediately before the base operand without explicit grouping using parentheses. Doing so throws a SyntaxError.
BigInt Compatibility
The** operator natively supports BigInt operands. However, standard JavaScript type-mixing rules apply: both the base and the exponent must be of the same type. You cannot mix a Number and a BigInt.
BigInt with a negative BigInt exponent throws a RangeError, as BigInts cannot represent fractional values.
IEEE 754 Edge Cases
Because JavaScript Numbers are double-precision 64-bit floats, the** operator adheres to IEEE 754 floating-point specifications for exceptional values:
Compound Assignment
The exponentiation operator can be combined with the assignment operator (=) to form the exponentiation assignment operator (**=), which evaluates the exponentiation and assigns the result to the left operand in a single step.
Master JavaScript with Deep Grasping Methodology!Learn More





