Open In App

Lodash _.lt() Method

Last Updated : 03 Nov, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

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
// 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.

javascript
// 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.

javascript
// 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.


Next Article

Similar Reads