0
Why console.log(obj[content]) First 'bike' is undefined
const data = ['car', 'car', 'truck', 'truck', 'bike', 'walk', 'car', 'van', 'bike', 'walk', 'car', 'van', 'car', 'truck' ]; let ans = data.reduce((obj,content)=>{ console.log(obj); console.log(obj[content]); if(!obj[content])obj[content]=1; else obj[content] += 1; return obj },{}); console.table(ans);
1 Answer
0
čč˛ć Can you make post this code and share the link here?