Monday, November 18, 2024
Google search engine
HomeLanguagesJavascriptLodash _.over() Method

Lodash _.over() Method

The Lodash _.over() method is used to create a function that invokes iteratee with the arguments it receives and returns its results.

Syntax: 

_.over(iteratees)

Parameters: This method accepts one parameter as mentioned above and described below:

  • iteratee: The iteratee to invoke.

Returns: This method returns a new function.

Example 1:

Javascript




// Requiring the lodash library  
const _ = require("lodash");              
  
// Use of _.over() method 
var func = _.over([Boolean, isFinite]);
  
// Saving the result
let gfg1 = func('10');
let gfg2 = func('-5');
let gfg3 = func('null');
let gfg4 = func('NaN');
       
// Printing the output  
console.log(gfg1); 
console.log(gfg2); 
console.log(gfg3); 
console.log(gfg4);


Output:

[true, true]
[true, true]
[true, false]
[true, false]

Example 2:

Javascript




// Requiring the lodash library  
const _ = require("lodash");              
  
// Use of _.over() method 
var func = _.over([(Math.min,  Math.max)]);
  
// Saving the result
let gfg = func(5, 10, -5, 20);
  
       
// Printing the output  
console.log(gfg);


Output:

[-5, 20]
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!

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments