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.
Just be sure to never use anything like this in production code, certainly if you expect other people to be able to maintain it.
You do some trial and error, if you wish (nobody is forcing you); this was not anything I did in an interview; finally, places like Leetcode are literally built on sharing interview questions, so I would answer "a lot of people" to your final line.
I thought the point of not specifying everything in interviews is to see if the candidate asks for clarifications or just makes assumptions. But that's not really doable in the "online coding challenges" context. So unless you're suggesting that every user of this website should message you before attempting your kata... you might want to clarify everything in the description ¯_(ツ)_/¯
Also... who posts their interview questions on the internet?!
I am conflicted here, as I try to produce interview-worthy kata and, as a rule of thumb, if something is not explicitly stated in such a context, you cannot rely on that ;)
...
is the spread operator:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator
I don't know how to explain it more clear. I've modified the example in description, added more than one debug lines in it.
Thanks for your feedback ;-)
I don't think your solution is actually passing all the tests. Rather, an error is being thrown that stops further tests from being run. Consider what String.prototype.match returns if there are no matches.