This article mainly shares with you a simple js bubble sorting sample code, I hope it can help you.
rb.data是一个数组对象
//根据itemPos大小冒泡排序for(var i=0;irb.data[j+1].itemPos){ var temp=rb.data[j]; rb.data[j]=rb.data[j+1]; rb.data[j+1]=temp; } } }
Related recommendations:
php bubble sorting example sharing
php bubble sorting array sorting method from small to large
Detailed explanation of bubble sorting method
The above is the detailed content of A simple js bubble sort example. For more information, please follow other related articles on the PHP Chinese website!