How to arrange js randomly
Editor to share with you how to randomly arrange the js, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Random arrangement
Among developers, sometimes we need to reshuffle the order of the array. The method of random sorting of arrays is not provided in JS. Here is a method of random sorting:
Function shuffle (arr) {var I, j, temp; for (I = arr.length-1; I > 0; iMel -) {j = Math.floor (Math.random () * (I + 1)); temp = arr [I]; arr [I] = arr [j]; arr [j] = temp;} return arr;} above are all the contents of the article "how to arrange js randomly". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!