This is how my array looks like: and my array is not type of string, it's type of it own object called MyObject (just like setter and getter objects in java)
["Car","model","year","color","price"]
["Table","model","year","color","price"]
["Car","model","year","color","price"]
["Car","model","year","color","price"]
["Laptop","model","year","color","price"]
["Laptop","model","year","color","price"]
now I want to group by this in typescript and count how many of that item exist in array (also like in sql)
name |count
Car | 3
Laptop| 2
Table | 1
and in my typescript file I have this
private groupByObjects() {
//this read all data in array allData[] from service
this.dataService.retrieveData().subscribe(allData => {
});
}
Could anyone please help me to write this in typescript?