How does it work?
This function is the opposite of $.reshape()
. Instead of creating 2d arrays from a 1d array, the $.flatten()
will create a 1d array from a 2d array, like that:
[[0, 1], [2, 3], [4, 5]]
// |
// v
[0, 1, 2, 3, 4, 5]
How to use it?
It's pretty simple, you simply need to give as an argument a 2d array.
Example
Let's reproduce what I showed you before:
JS:
$.flatten($.reshape($.range(5), 2)) // [0, 1, 2, 3, 4, 5]
⚠️ Questions?
Don't hesitate to ask your questions ⁉️ in the issue part 😁