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.
Very nice!!
I guess parameter 'a' means height,'b' means bounce ,'c' means window,and if a>c the default 'd'(also equals bounceTimes would be 1, cuz the ball would at least pass through the window one time),and 'e' is used for controlling the logical operator(&&).
At first, e = 1, so (e&&(condition)) will return true if the condition return a truthy value;and return false if condition return a falsy value.
Because 1&&true===true 1&&false===false.
And if the (a<0||b<0||b>=1||c>=a) return false, then calling the loop bouncingBall until 'a' is no bigger than 'c', the point is in here, 'e' will and always be 0 , that is preventing the code from returning -1(if the condition always return false,then the ternary operator will do the second statement, where the code is behind colon) .
This comment is hidden because it contains spoiler information about the solution
Perfectly explained for everyone!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
You did it so simple and nice, I had to create a variable in my case, but I like your approach!
var basically stands for variable; its value can change within the script, as such when hoisting, js will look for another value that me a variable to the same. const basically stands for "constant" as such, the value is fixed. For a short function as such, the value can be fixed!