A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/javascript/lodash-_-partial-method/ below:

Lodash _.partial() Method - GeeksforGeeks

Lodash _.partial() Method

Last Updated : 03 Sep, 2024

Lodash _.partial() method is used to create a function that invokes the given func function with prepended partials to the arguments it receives.

Syntax:
_.partial(func, partials);
Parameters: Return Value:

Example 1: In this example, we are using the _.partial() method to pass 'GeeksforGeeks' partially.

JavaScript
// Requiring the lodash library  
const _ = require("lodash");

// Given Function
function info(information, name) {
    console.log(information + ' ' + name);
}

// Using the _.partial() method  
let call_gfg =
    _.partial(info, 'GeeksforGeeks');
call_gfg('is a computer science portal for geeks');

Output:

'GeeksforGeeks is a computer science portal for geeks'

Example 2: In this example, we are using the _.partial() method to pass 'geeks' partially.

JavaScript
// Requiring the lodash library  
const _ = require("lodash");

// Given Function
function info(information, name) {
    console.log(information + ' ' + name);
}

// Using the _.partial() method  
let say_gfg = _.partial(info, _, 'geeks');
say_gfg('Hello');

Output:

'Hello geeks'


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4