DEV Community


Discussion on: Demystifying Array.prototype.flat

turnerj profile image
James Turner

I wonder if I am thinking of it similar to how substr works with the second argument.

"abc".substr(1, Infinity)

These both return "bc" and you don't need to worry about actually specifying the end of the string. I see this in the same way as flat(), it just seems like the more appropriate way of working.

I wonder now what the most common call to flat actually will be, whether it will be specifying a specific level or many just using Infinity.

Forem Open with the Forem app