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.
Thanks for the feedback, will hadd those examples tomorrow.
Just had another try and random tests looking good. Last thing to do is to add some example test cases, the ones the user sees when trying to solve.
Thanks for your help, ive now added more test cases as well as random ones. Let me know if there is anything else I should improve
Cheers :)
As Daredevil mentioned, putting the length condition in the for loop is the problem.
When you get an empty array in input, the for loop never runs! So, none of your return statements are called.
The function returns undefined by default which leads to a failed test.
Also, your function won't work on lists like
[1, 3, 2]
Because you return true as soon as you find an element being smaller than the next one instead of checking if all the elements satisfy this property.
You're attempting to iterate through an empty array, which seems to be the problem here. Be sure to use your conditional statement outside of the for-loop.