0👍
sort() method return value has 3 options: 1, -1, 0
top.sort(function (a, b) { return a.overallScore > b.overallScore ? 1 : a.overallScore < b.overallScore ? -1 : 0 });
- [Vuejs]-Datatable is not showing data used in vuejs code with api fetching
- [Vuejs]-Is there a way to create a default value for a v-select trough a function with vue.js / vuetify
0👍
change sort function to
a.overallScore – b.overallScore
let top = [
{overallScore: 1},
{overallScore: 2},
{overallScore: 8},
{overallScore: 12},
{overallScore: 4},
{overallScore: 5},
{overallScore: 3},
{overallScore: 29},
]
top.sort(function(a, b)
{
return (a.overallScore - b.overallScore);}
);
console.log(top)
- [Vuejs]-Append input element to form fieldset using vue
- [Vuejs]-How to fix unloaded images in "vue product zoomer" nuxt ssr
Source:stackexchange.com