Hi,
I need separate descending results for points and rebounds in one API call.
please see below my codes.
this.http.get('https://api.wh.geniussports.com/v1/basketball/statistics/personmatch/matches/784490/teams/88265?ak=eebd8ae256142ac3fd24bd2003d28782&periodNumber=0&limit=30
')
.map(res => res.json())
.subscribe(data => {
this.dataLeaders = data.response.data;
//sort api to points
let pointsL = this.dataLeaders.sort(function(a, b) {
return parseInt(b.sPoints) - parseInt(a.sPoints);
});
//sort api to rebounds
let reboundL = this.dataLeaders.sort(function(c, d) {
return parseInt(d.sReboundsTotal) - parseInt(c.sReboundsTotal);
});
console.log(pointsL);
console.log(reboundL);
}, err => {
console.log(err);
});
my problem is it’s both sorting with rebounds instead of sort for points and sort for rebounds