Searching for a workaround for flat map not working on IE led me to this solution, but the reasoning behind it eludes me.
var gadjets = [
{computers:['asus', 'hp'],
sellphones:['Galaxy', 'Nokia']
},
{computers:['dell', 'insys'],
sellphones:['iphone', 'samsung']
}
];
const getValues = gadjets.reduce((acc, gadjet) => acc.concat(gadjet[computers]), []) // instead of gadjets.flatMap(gadjet=> gadjet[computers])
The output of this code snippet is:
['asus','hp','dell','insys']
But shouldn't it actually return:
['asus','hp'],['dell', 'insys']