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.
**= (exponentiation assignment) operator performs exponentiation on the left operand using the right operand as the exponent, and assigns the resulting value to the left operand. It is a compound assignment operator that conceptually combines the exponentiation operation (**) with assignment (=), but guarantees that the left operand’s reference is evaluated exactly once.
Technical Characteristics
- Type Constraints: TypeScript enforces strict type checking on this operator. Both operands must resolve to either the
numbertype or thebiginttype. - Type Homogeneity: The operands must be of the exact same type. Mixing
numberandbigintwill trigger a TypeScript compiler error (TS2365) and a runtimeTypeError. - Mutability: The left operand must be a valid, mutable l-value (e.g., a variable declared with
letorvar, or a mutable object property). It cannot be aconstdeclaration or an r-value. - Evaluation Order: The left operand is evaluated exactly once. This is a critical semantic distinction from
x = x ** ywhen the left operand involves a complex expression with side effects. For example, inarr[getIndex()] **= 2, the functiongetIndex()is executed only once, whereasarr[getIndex()] = arr[getIndex()] ** 2would execute it twice. - Associativity: As an assignment operator,
**=is right-associative.
Syntax Mechanics
IEEE 754 Edge Cases
When operating onnumber types, the operator adheres to standard IEEE 754 floating-point arithmetic rules:
- If the right operand is
NaN, the result isNaN. - If the right operand is
0or-0, the result is always1(even if the left operand isNaN). - If the left operand is
NaNand the right operand is not0, the result isNaN.
Master TypeScript with Deep Grasping Methodology!Learn More





