2
Review
Your code is a good simple solution. The style is sloppy. The complexity is a bit high and the techniques uses are negatively impacting performance.
The template literal call Array.split`+` always throws me, but I like it, your code reminds me to use it more often.
General points
Delimit all code blocks. Eg if(n==0) return ["0"] better ...
1
Your code does not perform very well, I suppose because of the double recursion within the f-method.
It lacks readability: let's say you return to this code a year later: how long would it take to understand what you actually wanted to do?
Always use strict equality comparison (n == 0 => n === 0).
Readability can at least be enhanced by interpunction, ...
Only top voted, non community-wiki answers of a minimum length are eligible
Related Tags
node.js × 956javascript × 868
express.js × 159
promise × 93
mongodb × 77
ecmascript-6 × 62
beginner × 51
asynchronous × 47
mongoose × 47
performance × 41
api × 31
object-oriented × 29
typescript × 29
socket.io × 29
json × 26
async-await × 26
mysql × 25
http × 24
callback × 24
unit-testing × 23
error-handling × 21
parsing × 19
file-system × 19
server × 19
web-scraping × 17