How did you solve it? I have it working on node, but not in codewars?
For production queries, this is correct. But this challenge called for a "simple SELECT statement". I'd argue that select * is much simpler than listing all the column names. And for one-off queries, this is completely fine to use.
Although it is of course debatable to use production ready code everytime, at least when there is some focus on quality of code.
Agree. Schema is subject to change, so developers better specify the column names.
It does unless ES6 tail-call optimization takes effect. In this implementation, it does not take effect, because function call to map is not in tail-call position. See here: http://www.2ality.com/2015/06/tail-call-optimization.html
Does it not create a burden on memory with long list because of recursion and call stack ?
Yes - the function 'map' calls itself with the next node in the list. More info here
Is what you did called recursion? (using a function inside of itself)
I agree. Wording in this kata is an issue
I believe there's an issue with JS small cases:
number = 4, expected 0, but should expect 3 instead, number = 6, expected 3, but really should expect 8 (3 + 5)
Often this works for this problem:
It is not a bug of the kata but a CW bug, report it : Forum -> Bugs.
This comment is hidden because it contains spoiler information about the solution
Matches comma ' , ' if it's followed by a , '(?=,)' or '|' match ',' followed by space '\s' for as many spaces as there are '*' only if it is at the end of the input '$'