
array.flatMap() – Maps each element using a mapping function, then flattens the result into a new array.
๐ Syntax
newArray = array.flatMap(callbackFn[, thisArg]);
๐งช Example
['a','b'].flatMap(ch => [ch, ch.toUpperCase()]); // ['a','A','b','B']
Comments
Post a Comment