Python 3 should be enabled.
Thank you for these comments! Your reply and solution helped me think about this problem in a completely different way.
Not an issue
This comment is hidden because it contains spoiler information about the solution
for best practice we must have most readable short solution. For that Number() is not straightforward,
but for example n => parseInt(n) is most readable. Or ('' + n) is only a trick of js, but readable is toString(n).
Its just my suggestion.
Especially allowing year 0 makes this problem even worse. The Proleptic Gregorian Calendar (PGC) has no year 0. So what year does that value reference? The year before 1AD was 1BC and that was not a leap year. If you map each year n of your calendar to the year n-1 of the PGC, the formula for leap years becomes tricky.
IMHO the best solution would be to assert that the input to year_days will never be 0.
"" + n
Can someone explain why.map(Number) has to have Number in its params to pass this coding challenge, thank you.
Can someone explain why '' has to be added to n before splitting?
True, that is a new kata and not this one as it is simple.
Actually there was no Gregorian Calendar before 1582 (see https://en.wikipedia.org/wiki/Gregorian_calendar).
How about adding another rule to throw exceptions when year < 1583?
Although I couldn't tell you why we don't use Number() instead of Number.