> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript Exponentiation Assignment

The `**=` (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.

```typescript theme={"dark"}
leftOperand **= rightOperand;
```

## Technical Characteristics

* **Type Constraints:** TypeScript enforces strict type checking on this operator. Both operands must resolve to either the `number` type or the `bigint` type.
* **Type Homogeneity:** The operands must be of the exact same type. Mixing `number` and `bigint` will trigger a TypeScript compiler error (`TS2365`) and a runtime `TypeError`.
* **Mutability:** The left operand must be a valid, mutable l-value (e.g., a variable declared with `let` or `var`, or a mutable object property). It cannot be a `const` declaration or an r-value.
* **Evaluation Order:** The left operand is evaluated exactly once. This is a critical semantic distinction from `x = x ** y` when the left operand involves a complex expression with side effects. For example, in `arr[getIndex()] **= 2`, the function `getIndex()` is executed only once, whereas `arr[getIndex()] = arr[getIndex()] ** 2` would execute it twice.
* **Associativity:** As an assignment operator, `**=` is right-associative.

## Syntax Mechanics

```typescript theme={"dark"}
// Standard numeric exponentiation
let num: number = 2;
num **= 3; 
// num evaluates to 8 (2^3)

// BigInt exponentiation
let bigNum: bigint = 3n;
bigNum **= 2n; 
// bigNum evaluates to 9n

// Complex l-value evaluation
let index = 0;
const getIndex = () => index++;
const arr = [3, 4, 5];
arr[getIndex()] **= 2; 
// arr becomes [9, 4, 5], getIndex() is called exactly once

// Invalid: Type mixing
let invalidNum: number = 5;
// invalidNum **= 2n; 
// TS Error: Operator '**=' cannot be applied to types 'number' and 'bigint'.

// Invalid: Assignment to constant
const fixedNum: number = 4;
// fixedNum **= 2; 
// TS Error: Cannot assign to 'fixedNum' because it is a constant.
```

## IEEE 754 Edge Cases

When operating on `number` types, the operator adheres to standard IEEE 754 floating-point arithmetic rules:

* If the right operand is `NaN`, the result is `NaN`.
* If the right operand is `0` or `-0`, the result is always `1` (even if the left operand is `NaN`).
* If the left operand is `NaN` and the right operand is not `0`, the result is `NaN`.

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor TypeScript Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
