The JavaScript Greater Than Or Equal >= operator
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
<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
Frequently asked questions
What does >= mean in JavaScript?
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 >= ?
How do I check a value is within a range?
x >= min && x <= max for an inclusive range.