Answer the question
In order to leave comments, you need to log in
How to sort an array alphabetically VUE?
Hello.
Can you please tell me how to sort the array alphabetically by clicking on the button?
Klats
Answer the question
In order to leave comments, you need to log in
computed property to do of course :
computed: {
sortedUsers() {
return [...this.users].sort((a, b) => a.name.localeCompare(b.name));
},
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question