Sunday, September 22, 2024
Google search engine
HomeLanguagesJavascriptLodash _.isDecreasing() Method

Lodash _.isDecreasing() Method

The _.isDecreasing() Method checks whether the arguments are monotonically decreasing values or not or whether each argument is less than the previous argument.

Syntax:

_.isDecreasing(val1,val2,...,valn);

Parameters: This method n values to check for decreasing order.

Return Value: This method returns a Boolean value(Returns true if the given values are decreasing, else false).

Note: To execute the below examples, you have to install the lodash-contrib library by using this command prompt and execute the following command.

npm install lodash-contrib

Below examples illustrate the Lodash _.isDecreasing() method in JavaScript:

Example 1:

Javascript




// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
// Checking 
console.log("The Value is Decreasing : " 
            +_.isDecreasing(5,4,3,2,1));


Output:

The Value is Decreasing : true


Example 2: 

Javascript




// Defining lodash contrib variable 
var _ = require('lodash-contrib'); 
  
// Checking 
console.log("The Value is Decreasing : " 
             +_.isDecreasing(3,2,1,2));


Output:

The Value is Decreasing : false
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments