flat array method.
const names = ['AshKeys', ['Sojiro', ['Seta']]]console.log(names.flat(2)) // ['AshKeys', 'Sojiro', 'Seta']
By default, it flattens to 1 depth but we do can supply the depth level to be flattened.
If you do not know the depth you want, then it is better to give the max depth possible. Infinity
flatmethod is quite new to JS as it is specified in ES2019. I had to code the snippet in chrome console./O\