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.
This comment is hidden because it contains spoiler information about the solution
Description Suggestion JavaScript
If the input array contains anything other than integers, then return undefined.
Iterate through the array cubing each element meaning e3 or
e*e*e
.Grab only the odd cubed elements and return the sum.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
The returning undefined aspect of this Kata is a hindrance and it's problematic tbh
cool
It returns 0, as it is the sum of cubed odd numbers, where -3 cubed is -27 so it is infact:
-3 * -3 * -3 = -27 and 3 * 3 * 3 = 27 therefore -27 + 27 = 0
Why would this test suppose to return 0 ?
Test.assertEquals(cubeOdd([-3,-2,2,3]), 0);
3 * 3 * 3 = 27?
but
so, what if number is float (not equal to its integer part)? It is a number, but it is not an odd number (even or odd are defined only for integer)
Seems like, text might be
"The function should return undefined/None/nil/NULL if any of the values aren't integers"
and there must be any test with float (at least there are none of those in python version)
For JavaScript, no. For TypeScript, yes.
This comment is hidden because it contains spoiler information about the solution
Hm I tried to put this with null instead of 0, anyone know why this works over null?
Use spoiler flag next time, please.
This comment is hidden because it contains spoiler information about the solution
The name is
repeatStr
. It's called arrow function expression. It's missingconst
orlet
tho.Loading more items...