Can someone tell me what the values of "dirs" and "dir" is on the first iteration? I also don't know what the value of dirs[dirs.length - 1] is can someone tell me what that would be? I don't use the array methods that often, but I know that if the initial value is not given then it usually starts with the first two values in the array, like arr[0] and arr[1].
KANYE WEST!
Love it. Way more succinct than mine.
That's a great solution
took me 10 seconds to understand it
dirs is an accumulator which has been initialized as []
Sorry, first time commenting, already marked as spoiler. You could review my code, mine have never been reviewed. Thank you.
Sorry for my bad English. Google translate
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
WOW.. BIG FAN..!!
This comment is hidden because it contains spoiler information about the solution
Can someone tell me what the values of "dirs" and "dir" is on the first iteration? I also don't know what the value of dirs[dirs.length - 1] is can someone tell me what that would be? I don't use the array methods that often, but I know that if the initial value is not given then it usually starts with the first two values in the array, like arr[0] and arr[1].
Really not bad and usual code for understanding. I often forget the reduce can be used for array and etc not only for numbers
that's taken me a little bit of time to finger out why coding like this, why stack. nice work!
That's efficient and really clever. I didn't think of popping the array
Man im struggling to remember that reduce can also be used to initialize arrays. Nice one!
Loading more items...