Lodash _.lt() Method
Last Updated :
03 Nov, 2023
Lodash _.lt() method checks if the value is less than the other value.
Syntax:
_.lt(value, other);
Parameters:
- value: This parameter holds the first value that needs to be compared.
- other: This parameter holds the other value that is compared with.
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.
javascript
const _ = require( 'lodash' );
let num = _.lt(34, 67);
let less_elem = (num);
console.log(less_elem);
|
Output:
true
Example 2: In this example, it is returning false as 77 is not less than 77.
javascript
const _ = require( 'lodash' );
let num = _.lt(77, 77);
let less_elem = (num);
console.log(less_elem);
|
Output:
false
Example 3: In this example, it is returning false as 56 is not less than 36.
javascript
const _ = require( 'lodash' );
let num = _.lt(56, 36);
let less_elem = (num);
console.log(less_elem);
|
Output:
false
Note: This code will not work in normal JavaScript because it requires the library lodash to be installed.
Share your thoughts in the comments
Please Login to comment...