CKTIS / JavaScript
Less-than-or-equal operator (<=)
The <= operator compares two operands and returns a Boolean when evaluation completes normally. It includes the boundary value, but type conversions and NaN require care.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
left <= rightThe expression left <= right tests whether the left value is less than or equal to the right value under relational comparison rules. When evaluation completes normally, it returns true or false. For numbers, 5 <= 5 produces true, making the operator useful for inclusive limits.
If both operands are strings after conversion to primitive values, comparison is lexicographic by UTF-16 code units, not numeric or language-sensitive. Thus, "12" <= "3" produces true. Otherwise, numeric conversions apply: "12" <= 3 produces false, while null <= 0 produces true.
If operand coercion completes without throwing, a comparison involving NaN returns false, including when NaN results from converting undefined. Consequently, a <= b is not generally equivalent to !(a > b). It is not shorthand for a < b || a == b either: for example, null <= 0 produces true, although both parts of that alternative produce false.
Objects are converted to primitive values, which can execute custom code or throw an exception; comparing a Symbol throws TypeError. When checking numeric limits, ensure the data has the intended types rather than relying on implicit conversions.
Examples
console.log(3 <= 5);
console.log(5 <= 5);
console.log(6 <= 5);
console.log("12" <= "3");
console.log("12" <= 3);
console.log(null <= 0);
console.log(NaN <= 0);Result
true true false true false true false
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.