I created a secondary sort and its working but I don’t understand how.
this.report.sort((a, b) => {
if(a[col] > b[col]) return 1;
if(a[col] < b[col]) return -1;
if(a[secondaryFilter] > b[secondaryFilter]) return 1;
if(a[secondaryFilter] < b[secondaryFilter]) return -1;
});
I thought when the sort sees the first return, it would exit the sort. How does it reach the secondary filter sort?
The code works and I learned the syntax online but I don’t get how it works.