I have a problem sorting an array and I don't know why
P粉798010441
P粉798010441 2023-09-06 16:24:51
0
1
330

I have a problem with my code, I don't know why thes are not working and always giving different errors anyway i tried mistake: 'arraysorted' undefined no-undef

{{ arraysorted }}

P粉798010441
P粉798010441

reply all (1)
P粉362071992

You can use computed properties:

new Vue({ el: "#demo", data: () => ({ myArray: [1, 24, 23, 56, 76, 5, 468, 97, 65, 90, 23, 53, 23], }), computed: { arraysorted() { const arrSorted = [...this.myArray] return arrSorted.sort((a, b) => b - a) }, }, })
 
{{ arraysorted }} {{myArray}}
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!