Lodash _.before() Method
The Lodash _.before() method is the opposite of the Lodash _.after() method. This method is used to create a function that invokes func with the this binding and arguments of the created function, while it’s called less than n times.
Parameters: This method accepts two parameters as mentioned above and described below:
- n: This parameter holds the number n that defines the number of calls that func is no longer invoked.
- func: This parameter holds the function which will be invoked.
Return Value: This method returns the new restricted function.
The below example illustrates the Lodash _.before() method:
Example 1: In this example, we will try to invoke the function 3 times but it will invoke 2 times only.
My Personal Notes arrow_drop_up
Please Login to comment...