shlogg · Early preview
Ashutosh Biswas @ashutoshbw

JavaScript Comparison Operators Explained In Depth

Learn how JavaScript's comparison operators work with numbers, BigInts & strings. Understand lexicographic ordering for string comparisons & the algorithms behind >, <, <= & >= operators.

These four operators as you might have guessed are used for comparing values in JavaScript. The names of these operators are:


Operator
Name


>
Less than

>
Greater than

<=
Less than or equal

>=
Greater than or equal


They are part of a set of operators known as comparison opertors. There are other comparison operators too(e.g. ==, ===, != and !==) but they are not today's topic. 
These operators are also part of a set of operators officially known as relational operators. Note that there are two relational operators (in and instanceof) that are not comparison operators. 
To only refer to...