
array.flat() – Creates a **new array** with sub-array elements concatenated into it recursively up to the specified depth.
๐ Syntax
newArray = array.flat(depth = 1);
๐งช Example
[1,[2,[3]]].flat(2); // [1,2,3]

array.flat() – Creates a **new array** with sub-array elements concatenated into it recursively up to the specified depth.
newArray = array.flat(depth = 1);
[1,[2,[3]]].flat(2); // [1,2,3]
Comments
Post a Comment