Open In App

Lodash _.lt() Method

Lodash _.lt() method checks if the value is less than the other value.

Syntax:

_.lt(value, other);

Parameters:

Return Value:

This method returns true if the value is less than other else false.



Example 1: In this example, it is returning true as 34 is less than 67.




// Requiring the lodash library
const _ = require('lodash');
 
// Original array
let num = _.lt(34, 67);
 
// Using the _.lt() method
let less_elem = (num);
 
// Printing the output
console.log(less_elem);

Output:



true

Example 2: In this example, it is returning false as 77 is not less than 77.




// Requiring the lodash library
const _ = require('lodash');
 
// Original array
let num = _.lt(77, 77);
 
// Using the _.lt() method
let less_elem = (num);
 
// Printing the output
console.log(less_elem);

Output:

false

Example 3: In this example, it is returning false as 56 is not less than 36.




// Requiring the lodash library
const _ = require('lodash');
 
// Original array
let num = _.lt(56, 36);
 
// Using the _.lt() method
let less_elem = (num);
 
// Printing the output
console.log(less_elem);

Output:

false

Note: This code will not work in normal JavaScript because it requires the library lodash to be installed.


Article Tags :