Operators

Less than (<)

Try the free JavaScript compiler

Tests whether the left operand precedes the right operand. Two strings compare lexicographically by UTF-16 code units; numeric comparisons use magnitude. NaN makes the result false.

Formal Syntax & Structure

javascript syntaxjavascript
left < right

Parameters & Attributes

NameTypeDescription
leftexpressionLeft operand.
rightexpressionRight operand; short-circuiting may skip evaluation where applicable.

Return Value

Boolean

Result of the operation.

Working Example

Example Snippetjavascript
console.log("20" < "3");
JavaScript Reference