I am a newbie who just started learning, and I don’t know much. During my study, I found that the arrays are not completely arranged in size order when sorted using sort(). It has something to do with the number of digits, so I thought that I I tried to arrange the array in order from small to large, and typed some code myself, but in the end there was still a problem. Please explain and correct me.%
卢小强2019-11-02 13:50:15
It is recommended that if you want to write sorting by yourself, you can download the sorting method on Baidu. I personally recommend bubble sorting method.
卢小强2019-11-02 13:49:12
<script>function myFunction(){ var fruits = ["21421", "421421", "Apple", "Mango"]; fruits.sort(); var x=document.getElementById("demo"); x.innerHTML=fruits;}</script>I tried it and there seems to be no problem