We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b5f909a commit 7810899Copy full SHA for 7810899
README.md
@@ -119,3 +119,19 @@ const nonMuatatedArray = ['a','b','c','d','e'];
119
const newArray = nonMuatatedArray.filter((item'index) => !( index === 2 ));
120
console.log(newArray) //['a','b','d','e']
121
```
122
+
123
+# Did you know you can flat an array?
124
125
+```javascript
126
+const myArray = [2, 3, [4, 5],[7,7, [8, 9, [1, 1]]]];
127
128
+myArray.flat() // [2, 3, 4, 5 ,7,7, [8, 9, [1, 1]]]
129
130
+myArray.flat(1) // [2, 3, 4, 5 ,7,7, [8, 9, [1, 1]]]
131
132
+myArray.flat(2) // [2, 3, 4, 5 ,7,7, 8, 9, [1, 1]]
133
134
+//if you dont know the depth of the array you can use infinity
135
+myArray.flat(infinity) // [2, 3, 4, 5 ,7,7, 8, 9, 1, 1];
136
137
+```
0 commit comments