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.
it also check if number is negative or not
love IIFE and Closures
limited testing. it's essentially correct, even if somewhat incomplete.
HOW DID THIS PASS ???
in js Boolean(" ") return TRUE and Boolean(undefined) return FALSE, if the condition throw a false condition the string will be a space string.
This guy has not taken a shower in years
This comment is hidden because it contains spoiler information about the solution
Can think of it like this:
first, we set up way to handle all undefined cases
we'll be able to check and handle all other cases by combining the loop and if conditional
we can use guarded clause if that'll run only if the for loop doesn't return earlier
we put return undefined at the end of the code block
we know we need to return the value that is sequenced after the item
we can combine loop and conditional variable for COMBINED SET UP
when loop finds what it needs to find, we can tell it to modify variable outside of loop body
which means the next iteration runs
and that iteration - it contains the next value, which is what we're looking for
and then and there - we can use the changed variable outside of the loop function
and when that variable it's true and only then
we can just return that value, as it's the value right after the previous value
and the previous value was a match, equal to item
so if we return the value from the iteration that is right after that iteration that found the match
that'll always be the value we're looking for, given the problem specification
we need a loop that can iterate over any iterable, not just array
for...of... does that
now, in each iteration, we're getting the value
we check it against the item
if it is the item
It's probably best to go at these one at a time, and really get each item more deeply in a successive progression.
If you didn't know any of this - and never saw the solution before - what would make solving it that way a 100x easier, is more or less:
Mad, you made use of IFFE and Closures.
I had to take a deep look
lol
It isn't the best way haha, its terrible. I think maybe that is the point.
I would much prefer a solution from an actual human and not from the grandchild of Martians
The question was to solve the Bob's problem not to build a 'castle'.
what on earth
It adds nonsense on top of the starting code nonsense. It is not the best way of solving the problem.
Loading more items...