> ## 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.

# JavaScript Less Than Or Equal To

The less than or equal to operator (`<=`) is a binary relational operator that evaluates whether the left operand is less than or equal to the right operand. Internally, JavaScript evaluates `x <= y` by performing the Abstract Relational Comparison `y < x` and negating the boolean result (`!(y < x)`). If the underlying comparison evaluates to `undefined` (which occurs when either operand coerces to `NaN`), the `<=` operator explicitly returns `false`.

```javascript theme={"dark"}
leftOperand <= rightOperand
```

## Evaluation Mechanics

When the JavaScript engine evaluates the `<=` operator, it executes the **Abstract Relational Comparison** algorithm. The process follows strict type coercion rules:

1. **`ToPrimitive` Conversion:** Both operands are converted to primitive values. If an operand is an object, the engine first attempts to call its `[Symbol.toPrimitive]()` method. If this method is absent, it falls back to calling `valueOf()` and `toString()` in sequence until a primitive is yielded.
2. **String Comparison:** If both resulting primitives are strings, they are compared lexicographically based on their sequence of 16-bit unsigned integer values (UTF-16 code units).
3. **String and BigInt Comparison:** If one primitive is a `String` and the other is a `BigInt`, the string is converted directly to a BigInt via the `StringToBigInt` algorithm. This prevents the precision loss that would occur if a large numeric string were coerced to a standard Number.
4. **Numeric Comparison:** For all other type combinations where at least one primitive is not a string, both operands are coerced to numeric values (via the `ToNumeric` algorithm) and compared mathematically.

## Type Coercion Behavior

Because of implicit type coercion and the inverse evaluation model (`!(y < x)`), the operator exhibits specific behaviors depending on the operand types:

```javascript theme={"dark"}
// Standard numeric comparison
5 <= 5;       // true
10 <= 5;      // false

// Lexicographical string comparison
"apple" <= "banana"; // true (UTF-16 code unit for 'a' is less than 'b')
"10" <= "2";         // true (UTF-16 code unit for '1' is less than '2')

// Mixed types (String coerced to Number)
"10" <= 20;   // true (String "10" becomes Number 10)
"a" <= 5;     // false (String "a" becomes NaN)

// Booleans (Coerced to Number: true -> 1, false -> 0)
true <= 1;    // true
false <= 0;   // true

// Null and Undefined
// null <= 0 evaluates as !(0 < null). null coerces to 0, so 0 < 0 is false. !(false) is true.
null <= 0;      // true 
null < 0;       // false
null == 0;      // false

undefined <= 0; // false (undefined coerces to NaN)
```

## Special Numeric Values

The operator handles IEEE 754 special numeric values and BigInts according to specific rules:

* **`NaN`:** Any relational comparison involving `NaN` evaluates to `undefined` internally, causing the `<=` operator to return `false`. This includes `NaN <= NaN`.
* **Zero:** `+0` and `-0` are considered mathematically equal.
* **Infinity:** `+Infinity` is greater than or equal to any number. `-Infinity` is less than or equal to any number.
* **BigInt:** `BigInt` and `Number` types can be compared directly without throwing a `TypeError`.

```javascript theme={"dark"}
NaN <= 5;          // false
5 <= NaN;          // false
NaN <= NaN;        // false
-0 <= +0;          // true

// BigInt and Number comparison
10n <= 10;         // true 

// String and BigInt comparison (StringToBigInt preserves precision)
"9007199254740993" <= 9007199254740992n; // false
```

<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 JavaScript 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>
