Lodash _.partialRight() Method
Last Updated :
27 Oct, 2023
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
const _ = require( "lodash" );
function info(information, name) {
console.log(information + ' ' + name);
}
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
const _ = require( "lodash" );
function info(information, name) {
console.log(information + ' ' + name);
}
let say_gfg =
_.partialRight(info, 'Hello' , _);
say_gfg( 'geeks' );
|
Output:
'Hello geeks'
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...