`flat()` method in JavaScript ✨
📌The flat() method creates a new array by flattening the elements of the input array.
📌You can specify the depth of flattening as an argument. By default, the depth is 1.
📌Using Infinity as the depth will completely flatten the array, regardless of how deeply nested it is.
Checkout more JS built-in methods here:
scriptbinary.com/js/javascript-hidden-gems
Back