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.
You were modifying your input weren't you?
Your isprime function is not correct. Google is your friend.
Let's say you create a "three", its value should stay at
3
, then you add "seven" and get "ten", then you have the same "three" and add "eight" to it, you'd expect you'd get "eleven", when you mutated the value, you'll get "eighteen" instead. I don't know if this helps (that's what the sample tests do, create a single number and add different values to it).You're mutating number property in add method, you shouldn't.
Because
let arry=arr;
doesn' create a copy, that's another reference to the same array.Assuming you're using JavaScript, you don't need to use arrays, you can directly solve the kata using string functions like slice and replace.