When i try:
this.rezerwacjeFilteredByseaarchInput.sort(function (a, b) {
if (this.idSortOrder) {
return a[0].id - b[0].id;
}
else {
return b[0].id - a[0].id;
}
});
js throws: this.idSortOrder is undefined. but when i try:
let idSortOrder = this.idSortOrder;
this.rezerwacjeFilteredByseaarchInput.sort(function (a, b) {
if (idSortOrder) {
return a[0].id - b[0].id;
}
else {
return b[0].id - a[0].id;
}
});
it works. can anybody show me how to this.idSortOrder directly in sort or foreach function?