Open In App

Lodash _.partialRight() Method

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:

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.




// 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.




// 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'

Article Tags :