2 ms·
I don’t think they picked the best example to showcase this, most JavaScript developers would write this simply as: Array.from({ length: n }, (_, i) => i +
by runarberg 3y ago
I don’t think they picked the best example to showcase this, most JavaScript developers would write this simply as:
Array.from({ length: n }, (_, i) => i + 1)
But this example does get the point across, so I think it is fine. I do agree though, while reading it the inefficientness was screaming at me.