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.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length
Why numbers.length::: HOW THE FUCK THIS IS CALCULATED?
As i know there is no need to specify every element like this "age:age" if you are still using the same name. Only if you want to change a name of argument, like this "firstName:name"(Where "name" is argument and firstName will be name of the key in the future)
This is the problem of your solution.
JavaScript
in what language? You're supposed to return -1 for empty array, yes.
specifically for the reason you just gave: sum of nothing == 0 ;)
There is nothing between the two negative elements in the list [5,-1,-2], so why is the result 0?
I would suggest adding what you wrote: "Empty sum gives 0, no sum gives -1" or what you wrote in another reply: "[-1,-1] returns 0. [] returns -1". I understand your reasoning I'm just hoping to clear things up for beginners.
Is there issue with fixed tests and random tests? When input is empty array and my solution gives -1 for output the message from tests is: "expected -1 to equal 0". But when I change my solution and output now is 0 for empty array the message from tests is: "expected 0 to equal -1".
The tests for JS have been modified and improved over past 5 days.
And since you have not responded either, I am closing the issue.
I ran the test cases using your code, and did not have an issue with the random tests whatsoever.
They all passed.
By the way, I am using
Node v12.x
I hope that helps.
JavaScript
Which language?
On "run random tests" I get this message: "expected true to equal false". But my solution gives "false" to all random tests.
Loading more items...