I have this array, I want to sort it ticketid wise, which is a number. Below is the code I am trying
console.log(this.tableData);
var filtered_tableData = this.tableData.sort((a, b)=> a.ticketid- b.ticketid)
console.log(filtered_tableData);
But it is not sorting as expected.
Here is my array:
Edit 1
After trying this code, my result array still remains the same
console.log(this.tableData);
var filtered_tableData = this.tableData.sort((a,b) => (a.ticketid > b.ticketid) ? 1 : ((b.ticketid > a.ticketid) ? -1 : 0));
console.log(filtered_tableData);
Please note this.tableData and filtered_tableData result is same in console.log.
See image below

