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.
Thanks, cstuncsik!
In javascript
this
refers to the object you call a function on. But since a function is also an object in javascript you can dothis()
.Here
this
refers to the function you callpipe
on, so you call the original function with the arguments and pass the result to the piped function as an argument soaddOne.pipe(square)(1)
is actuallysquare(addOne(1))
wherethis
refers toaddOne
This comment is hidden because it contains spoiler information about the solution
@user2686621 If you google "change of base," there are two good resources - purplemath and khan academy. Each has a helpful explanation of what's going on here. As for the logarithm itself, there is no "physics" meaning. Instead, think of it as a mathematical construction where log(x) means "the exponent of 10 (or whatever the 'base' of the logarithm is - e in this case) that gives me x." Not sure if this helps, but hope so.
I think setting rebounds to -1 initially takes care of the "last bounce" problem.
Not sure what you mean by asynchronous code, but this solution definitely slows down considerably as the list lengthens. And yes, using a for loop that returns as soon as it finds its target, you'll return the answer more or less instantly if that target is near the beginning, even on lists millions of ints long. Not so for this 'top' solution.
This isn't async code, this is functional programing.
This comment is hidden because it contains spoiler information about the solution