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.
Can't you just fix the test?
See my post. I agree: totally an issue with the tests.
The random tests are incorrect. All of them. The first argument passed to the deleteNth function should be an array and the second argument should be a number. I actually cannot find a single random test that is passing the correct arguments.
Example:
Testing for delete_nth([17, 33, 1, 47, 33, 47, 17, 33, 17, 17, 17, 47, 47, 13, 17, 33,2)
There should be a second bracket following the (last) 32.
ALSO:
The tests run delete_nth and not deleteNth!
My code appears to be correct & I have checked it outside of CodeWars multiple times and it functions perfectly. However, when I hit "ATTEMPT" it comes back as failing 40 tests. After looking through the error messages, it looks to me like, for the tests I am failing, there is no closing ] on the input array which is causing an issue.
ex: I copied and pasted this error message:
Random tests
Testing for delete_nth([49, 10, 36, 10, 4, 33, 49, 4, 10, 33, 5, 32, 4, 10, 49, 32, 32, 10, 32, 4, 10, 49, 4, 33, 36, 33, 5, 49, 32, 32, 49, 4, 4, 33, 32, 5, 49, 49, 10, 4, 5, 49, 32, 10,2)
✘ It should work on random inputs too! - Expected: '[49, 10, 36, 10, 4, 33, 49, 4, 33, 5, 32, 32, 36, 5]', instead got: '[49, 10, 36, 10, 4, 33, 49, 4, 33, 5, 32, 32, 36, 5, [Function]]'
There is no closing ] before the 2 in the test input!! Using a separate code editor, outside of CodeWars, when I use my code, then I copy and paste the above test & I add in a closing bracket, everything works perfectly.
This seems like an issue with the tests & not my code. If I am wrong, please explain!!!
alyshae, there are a huge array in tests. Try to test time of
for-in
and classical for (for (let i = 0...)
). Which is faster?This comment is hidden because it contains spoiler information about the solution