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.
In case you're getting a message like
Got b,c,a,d,e. Expected array values = b,c,a,d,e
, it's probably because you're usingsplice
, which returns an ARRAY.Wow, some comments are three/four years old, and you did not process them? Anyway, I updated the description fixing several typos and grammar issues. Still this kata should not be approved if no effort is made to:
Also, returning "no target" is really not in line with best practice that return values should be of the same type (except for
null
orundefined
). A function that sometimes returns an array and sometimes a string is badly designed. I would suggest to review this behaviour.Could do with example tests, e.g. those from the description.
Got the working solution but it won't let me pass... I tested myself many times and my function wokrs well.
"Got a,b,c,d,e. Expected array values = c,a,b,d,e"
I think something is wrong here...
I agree. It's horrible to have a method that can return either a string or an array depending on circumstances.
Returning an unmodified array or throwing would be better.
It's super unclear that your supposed to return a new array. And if you don't do it, you get a very poor error about undefined having no length property.
OR
OR
assgin, you meant assign.
Hmmmm. Got b,c,a,d,e. Expected array values = b,c,a,d,e
Something I'm missing?
I would prefer for example, that instead of returning 'no target' it returns either the array unchanged or an empty array. In this case it's always returning an array.
you assgin doesn't
->you assign doesn't
You are given [] an empty array and floor 1. The hotel is empty, so floor 1 is empty. I am not sure how you populated the hotel with those names.
don't know what to do with the first basic question
not correct [], 1 given - Expected: [], instead got: ["foo","bar","foobar","barfoo","foofoo","barbar"]
why fun(arr, 1) should return an empty array?
I passed all the test cases, only failed at this one.
anyone?
That's true. I didn't search for similar task before I publish.
thx for your feedback
There are already an abundance of already-approved prime number katas in JavaScript:
I don't feel that this adds anything to the existing katas.
Sorry!
A nice concept; well done. There was a typo in the description:
you should aware
should beyou should be aware of
, or something like that.You can use
Test.assertSimilar(result, expected, message)
to test things like objects or arrays. This will also print out a "got... expected..." message in addition to whatever message you add to it. This will also avoid running the.move()
twice.If you wanted, you could randomise the order of the tests, by sticking in the inputs in an array, and using
Test.randomize(array)
to reorder them; then loop over them and test the inputs. This will make it harder to cheat the tests. And if you want to go the whole hog, you can randomly generate tests, too.This issue is now resolved (I forgot to mark it as such before posting my previous reply).
Feel free to mark any of these comments as having spoiler content. I'm on the fence about it: on one hand, they may contain helpful information for others; on the other hand, it may be a bit too much information.
Loading more items...