Flattening streams

Flattening arrays

You may have heard of a flatten function.

flatten functions take an input of some sort and “unwrap” it. (In this case, unwrapping an array is to pull out the elements in the array and use those.)

This hypothetical code snippet returns [2, 4, 7, 12]:

flatten([[2], [4, 7], 12])

Get hands-on with 1400+ tech skills courses.