Open In App

Lodash _.gt() Method

Improve
Improve
Like Article
Like
Save
Share
Report

Lodash _.gt() method is used to find whether the value is greater than others or not. It returns true if the value is greater than the other value. Otherwise, it returns false.

Syntax:

_.gt(value, other);

Parameters:

  • value: This parameter holds the value to compare.
  • other: This parameter holds the other value to compare.

Return Value:

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

Example 1: In this example, we are comparing two values whether the value is greater than the other or not by the use of the lodash _.gt() method.

Javascript




// Requiring the lodash library 
const _ = require("lodash");
 
// Use of _.gt method
console.log(_.gt(19, 8));
console.log(_.gt(15, 17));


Output:

true
false

Example 2: In this example, we are comparing two values whether the value is greater than the other or not by the use of the lodash _.gt() method.

Javascript




// Requiring the lodash library 
const _ = require("lodash");
 
// Use of _.gt method
console.log(_.gt(13, 13));
console.log(_.gt(29, 17));


Output:

false
true

Last Updated : 31 Oct, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads