This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ``` | |
| //If we have nested arrays of depth = 1: | |
| var arr = [[1,2,3],[4,5],6]; | |
| //we can flatten it by using concat and apply | |
| var flat_arr = [].concat.apply([],arr); | |
| //and check the value | |
| console.log(flat_arr); | |
| //logs [1,2,3,4,5,6] | |
| ``` |