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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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
.