A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/less-than-comparison-operator-in-javascript/ below:

Less Than(<) Comparison Operator in JavaScript

Less Than(<) Comparison Operator in JavaScript

Last Updated : 23 Jul, 2025

JavaScript Less Than(<) Operator is used to compare two operands and return true if the left operand has a lesser value than the right operator. The values are converted to equal primitive types before conversion If both the values are strings the comparison is done on the basis of their Unicode. Boolean values like true and false are converted to 1 and 0 respectively.

Syntax: 

a<b

Example 1: In this example, we will compare String, Number, and Boolean using Less Than Operator.

JavaScript
console.log("3"<2);
console.log("2"<3);
console.log(true<false);

Output: The String and Boolean values are converted to Numbers and compared.

false
true
false

Example 2: In this example, we will compare BigInt, and other data types Less Than Operator.

JavaScript
console.log(2<2n);
console.log(5n<4);
console.log(undefined<null);
console.log(null<undefined)

Output: Similar to the previous example, the values are first converted to numbers and then compared.

false
false
false
false

Supported Browsers:

We have a complete list of JavaScript Comparison Operators, to check those please go through, the JavaScript Comparison Operator article



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4