References

Beginner-friendly references for web development, with live, editable examples.

The JavaScript Greater Than Or Equal >= operator

Operator JavaScript All modern browsers Updated
Quick answer

The >= operator returns true if the left value is greater than or equal to the right. 5 >= 5 is true. It follows the same rules as > — numeric for numbers, alphabetical for two strings — and any comparison with NaN is false.

Overview

>= is greater than with equality included: it's true when the left value is greater than or exactly equal to the right. 5 >= 5 and 6 >= 5 are both true. It's the natural choice for inclusive bounds — "at least", "minimum", "this age or older".

It shares all the comparison behavior of its strict-greater sibling: numbers compare numerically, two strings compare alphabetically by character code (so "10" >= "9" is false), and mixed types coerce to numbers. Convert numeric strings with Number() when comparing values that arrive as text.

The NaN rule holds here too — NaN >= NaN and any comparison touching NaN are false. Together with <= it expresses inclusive ranges: x >= min && x <= max.

Syntax

a >= b

5 >= 5    // true
6 >= 5    // true
4 >= 5    // false

// inclusive range check
x >= min && x <= max

Example

Live example
<pre id="out" style="font:14px ui-monospace,monospace"></pre>
<script>
  function band(score) {
    if (score >= 90) return 'A';
    if (score >= 80) return 'B';
    if (score >= 70) return 'C';
    return 'F';
  }
  document.getElementById('out').textContent =
    [95, 82, 70, 50].map(s => s + ' -> ' + band(s)).join('\n');
</script>

Best practices

  • Use >= for inclusive lower bounds ("at least", "minimum").
  • Combine it with <= for an inclusive range: x >= min && x <= max.
  • Convert numeric strings with Number() before comparing.
  • Remember comparisons with NaN are always false.

Frequently asked questions

What does >= mean in JavaScript?
It returns true if the left value is greater than or equal to the right, e.g. 5 >= 5 is true.
What is the difference between > and >= ?
> is strictly greater; >= also returns true when the values are equal.
How do I check a value is within a range?
Combine both bounds: x >= min && x <= max for an inclusive range.
Does >= coerce strings to numbers?
Only with mixed types. Two strings compare alphabetically; a string and a number coerce to numbers.