You need Login/Signup to run/submit the code.
Implement a function that accepts a callback and restricts its invocation to at most N times | Lodash Polyfills | Frontend Problem Solving
@Devtools Tech
In this question, you need to create a function that accepts a callback
restricts its invocation to the provided n
times. It is similar to the _.before
method provided by the Lodash
library.
Calls to the function after the limit should return the value of the last invocation. The callback
is invoked with the this
binding and arguments of the created function.
Syntax
limit(callback, n);
Arguments
callback (Function)
: The function to restrict.n (number)
: The number of calls at whichcallback
is no longer invoked.
Returns
(Function)
: Returns the new restricted function.
Submission
Start the timer, complete your solution, test your solution against the test cases provided by the platform, and submit it. Ideally, you should finish this question within 30 mins.