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.
Initial Test was of the form
Test.assertEquals(liftoff(arr), solution(arr))
,arr
being an array of random number of numbers in random order,liftoff
the solution user submit andsolution
the test solution solving the kata.Then,... if
arr
was modified by theliftoff
function, the result ofsolution
may be not the expected one.For now, the test is modified to
Test.assertEquals(liftoff(arr), res)
,res
being result ofsolution(arr)
computed beforearr
is passed to theliftoff
function.That's why your solution now passes.
Arrays and other objects are referenced not copied into functions. Your actual submitted versions works since you don't add additional values to the array (no
.push()
).You modify the
instructions
. Don't. The original author expects your function to be pure.I really don't understand where this "liftoff!" prefix come from.
Here an example of what should (normaly) occurs:
Can you please post your code and mark it as spoiler ?
(you'll don't see it no more but warriors who solved the kata will can)
It isn't. Do you modify the array?
What's the error message please ?