What flatten yields for one element: an iterable's items, and anything else, including a string, as
itself. That matches the runtime, which spreads arrays and other non-string iterables. Languages
disagree on strings: Scala and Python split them into characters, JavaScript's flat keeps them whole.
What
flattenyields for one element: an iterable's items, and anything else, including a string, as itself. That matches the runtime, which spreads arrays and other non-string iterables. Languages disagree on strings: Scala and Python split them into characters, JavaScript'sflatkeeps them whole.