Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Insert a print statement at the beginning of the function. It will print the random test case.
JS, unlike other langs such as Haskell, has no builtin lazy evaluation support
Which means all arguments will be evaluated before passing them to the function
Also,
replace
only takes two does not means other arguments will not be evaluatedSo, given
You can transform it into an equivalent form
You can feed any number of arguments to any functions as you like, and they only care about just the amount they required
Which means
it.replace(a,b,c,d,e)
has nothing different withit.replace(a,b)
in the view ofreplace
methodPS. Actually there is a limit of arguments number depends on the implementation. Like if you feed too much to a function in the latest Chrome, you will get
SyntaxError: Too many arguments in function call (only 65535 allowed)