Lodash _.isIncreasing() Method

The Lodash _.isIncreasing() method checks whether the given values are monotonically increasing or not (each argument is greater than the previous argument).
Syntax:
_.isIncreasing(val1, val2, ..., valn);
Parameters: This method takes n values to checked for increasing order.
Return Value: This method returns a Boolean value (Returns true if the given values are Increasing, else false).
Note: This will not work in normal JavaScript because it requires the lodash.js contrib library to be installed. Lodash.js contrib library can be installed using npm install lodash-contrib.
Example 1:
Javascript
// Defining lodash contrib variable var _ = require('lodash-contrib'); // Check for increasing order console.log("The Value is Increasing order : " + _.isIncreasing(1, 2, 3, 4)); |
Output:
The Value is Increasing order : true
Example 2:
Javascript
// Defining lodash contrib variable var _ = require('lodash-contrib'); // Check for increasing order console.log("The Value is Increasing : " + _.isIncreasing(3, 2, 1, 2)); |
Output:
The Value is Increasing : false
Example 3:
Javascript
// Defining lodash contrib variable var _ = require('lodash-contrib'); // Check for increasing order console.log("The Value is Increasing : " + _.isIncreasing('a', 'b')); console.log("The Value is Increasing : " + _.isIncreasing('c', 'b', 'a')); |
Output:
The Value is Increasing : true The Value is Increasing : false
Example 4:
Javascript
// Defining lodash contrib variable var _ = require('lodash-contrib'); // Check for increasing order console.log("The Value is Increasing : " + _.isIncreasing("Geeks", "GFG")); console.log("The Value is Increasing : " + _.isIncreasing('g', 'G')); |
Output:
The Value is Increasing : false The Value is Increasing : false
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, zambiatek 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!



