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.
And what about this?
last({}, { length: 'foo' }); //'foo' - 1? WTF?
A bit late, but... Could you please reformat it with starting and ending triple backticks, then tell us the relevant error message?
Wasn't anyway using
Math.max()
for maxLength or directly return eithertrue
/false
or a better way of handling things?P.S.: cool Latin nick.
Because the number of solutions already registered (>1300) I think now kata can not be changed.
As already mentioned, there're some corner cases, that don't fit.
Test.assertEquals(last(), undefined); //-- undefined
Test.assertEquals(last(1, [2, 3]), [2, 3]);//-- last item is array
I think if there are multiple arguments and the last one is an array, the return value could be a little bit confusing. Of course a special situation but who knows :)
Your functions are changing the
values
array. It wasn't originally[11, 12]
- yourminimumSum
function changed it.Try logging
values
before and after calling your functions to see that it's being changed within your function:Javascript passes arrays and objects by reference, so if your code changes the array, it can have unintended side effects. Always try to avoid changing objects and arrays that were passed as arguments. If you need to modify them, make a copy first and modify that.
Hi,
If you try to run an test of your own with the following values, what do you get as an answer?
Got an error : "maximumSum with n=3 not working" while submitting. While inspecting console.log gives :
What's wrong???
This comment is hidden because it contains spoiler information about the solution