I'm learning javascript and I have some problems. I would like to iterate an array of objects but with a few "options":
- don't display duplicate items.
- display the number of items.
expected result :
received 1
missed 2
dialed 3
I know how to iterate a array of objects and use .length to display the quantity of each item but I don't know iterate + display quantity + remove duplicates... Can you help me ?
const calls = [
{
type: "missed",
date: "xx-xx-xx"
},
{
type: "received",
date: "xx-xx-xx"
},
{
type: "dialed",
date: "xx-xx-xx"
},
{
type: "missed",
date: "xx-xx-xx"
},
{
type: "dialed",
date: "xx-xx-xx"
},
{
type: "dialed",
date: "xx-xx-xx"
}
];