Less-than Operator


Comparison Less-than

comparison less-than operator takes two operands, returns true if value in left side operand is less than that of the right operand, or false otherwise

< symbol is used for comparison less-than operator

a < 5  //returns true if a has a value < 5
a < b  //returns true if a has a value < b

Examples

1. check if value in a is less than 5

var a = 3;
if (a < 5) {
    console.log('a is less than 5');
} else {
    console.log('a is not less than 5');
}

2. check if value in a is less than that of in b

var a = 9;
var b = 4;
if (a < b) {
    console.log('a is less than b');
} else {
    console.log('a is not less than b');
}