I have the following Vue method that I need to add JS .sort() to in order to order output alphabetically. I learned JS backward learning framework first and am struggling to understand how I need to make this work JS-wise:
filteredByCat (cat) {
return this.businesses.filter((element) => {
return element.cat === cat.name
})
},
Somehow I need something like this:
filteredByCat (cat) {
return this.businesses.filter((element) => {
return (element.cat === cat.name).sort()
})
},