Javascript ES2019 tip #1

Chrome Version 72 rolled out new exciting ES10 features for developer to use in browser. Flatten your multi-dimensional arrays using ES2019's [].flat()

const arr = ['a', 'b', ['c', 'd']];
const flattened = arr.flat();

console.log(flattened);    // => ["a", "b", "c", "d"]
Show Comments