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.
That's your opinion and it's fine, but I think it's no more than that: your opinion.
Personally I do prefer to cover all possible cases that I can think of, even if they aren't necessary to pass the tests, regardless if the kata is actually meant to be like that or if the creator didn't take such cases into account by mistake.
In the real world you will often need to cover all possible cases in order to prevent errors, so this way it helps me develop that kind of skills, if you want to call it like that.
A lot of people seem to misunderstand the fundamental philosophy of the kata. The point of a kata is not to have production code in the answer. The point of a kata is to practice solving individual, targeted problems. Then, later when you're writing production code, you have the "muscle memory" of solving each individual problem in your katas, and can merge pieces of multiple katas into a whole production solution.
In the same way, in karate one practices katas--sequences of moves--but one would never perform a kata in a fight. One would take pieces of katas, individual moves, expertly executed from extensive practice, in response to the opponent's moves at the time.
What does that mean here? Here, there's no need to verify the arrays are the same length. That's not part of this kata, it doesn't make sense to include that in the kata, that's not an interesting, targeted problem to solve. There's no need to worry about mutating the arguments. The arguments will not be used later, they are disposed. The kata author makes us perform a null check; that was a mistake, a sign of someone who does not understand the philosophy of katas.
This kata is about comparing two arrays with a custom comparison rule. Anything outside that core, targeted problem is irrelevant.
A lot of people seem to think that adding a lot of cruft to every single kata method somehow makes the solutions better. It doesn't. It's a waste of time. You learn nothing by adding a null check or an array length check to even an intermediate kata. Cut your katas down to the bone. Solve only the interesting problems.
I don't like the fact that this solution modifies the arguments passed. Perhaps it would be better to use a shallow/deep copy?
This assessment is correct. The tests are incomplete and do not cover all of the necessary cases to determine whether the spec has been met.
great
I'm a new coder. I didn't mean any disrespect. I'm just trying to learn.
What, in your directions, makes it clear that the input arrays will always have the same length?
The question you're asking is, "What if this kata was a different kata?"
Then I would have written different code. But it's not a different kata. It's this kata. And in this kata the arrays always have an equal number of elements.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Great solution! I didn't think about using the every method in my code, that was a great idea.
Your solution looks very neat and easy to read.
well , we can use Array.from() to convert arraylike object to a truely array, however this task seems to apply many languages ,which means in Js maybe the form of inputs are just truely array
console.log(comp([], [25,9,54])) // return true , i dont think the solution is 100% working, no idea how it passed the test ???
But what about the case when either a or b is {}?
Loading more items...