Open In App

Lodash _.partialRight() Method

Last Updated : 27 Oct, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Lodash _.partialRight() method is used to create a function that invokes the given func function with the appended partials to the arguments it receives. It is almost the same as the _.partial() function.

Syntax:

_.partialRight(func, partials);

Parameters:

  • func: This parameter holds the function to partially apply arguments.
  • partials: This parameter holds the arguments to be partially applied. It is an optional parameter.

Return Value:

This method returns the new partially applied function.

Example 1: In this example, we are passing a string partially to the function by the use of the lodash _.partialRight() method.

Javascript




// Requiring the lodash library 
const _ = require("lodash");
 
// Given Function
function info(information, name) {
    console.log(information + ' ' + name);
}
 
// Using the _.partialRight() method 
let call_gfg =
    _.partialRight(info,
        'is a computer science portal');
call_gfg('GeeksforGeeks');


Output:

'GeeksforGeeks is a computer science portal'

Example 2: In this example, we are passing a string partially to the function by the use of the lodash _.partialRight() method.

Javascript




// Requiring the lodash library 
const _ = require("lodash");
 
// Given Function
function info(information, name) {
    console.log(information + ' ' + name);
}
 
// Using the _.partialRight() method
// with placeholders
let say_gfg =
    _.partialRight(info, 'Hello', _);
say_gfg('geeks');


Output:

'Hello geeks'


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads