Software dev at Netflix | DC techie | Conference speaker | egghead Instructor | TC39 Educators Committee | Girls Who Code Facilitator | Board game geek | @laurieontech on twitter
Software dev at Netflix | DC techie | Conference speaker | egghead Instructor | TC39 Educators Committee | Girls Who Code Facilitator | Board game geek | @laurieontech on twitter
I wonder if I am thinking of it similar to how substr works with the second argument.
"abc".substr(1)"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.
Software dev at Netflix | DC techie | Conference speaker | egghead Instructor | TC39 Educators Committee | Girls Who Code Facilitator | Board game geek | @laurieontech on twitter
Also maybe worth mentioning that
is the same as
not
Infinity
as one might expect.Interesting - without looking at the docs or anything, I would have (incorrectly) assumed:
was to to flatten all the way down like Laurie's last example
This is why I thought it should be mentioned. It kept catching me out when I was trying it out.
Added :)
Apparently that’s a lot of people’s assumption which actually surprises me!
I wonder if I am thinking of it similar to how
substr
works with the second argument.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 usingInfinity
.For sure. Great to point that out.