Most efficient array shuffler

前端 未结 4 1793
自闭症患者
自闭症患者 2020-12-07 02:42

How can I shuffle an array\'s values in the most efficient manner possible?

Each element is just a string containing HTML.

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-07 02:48

    This is my solution to shuffle an array:

        function shuffle(array) {
           var resultArray = new Array();
           for(i=0;i

    This is a shuffle contest to compare my method with the other 2

    http://jsperf.com/shuffle-contest/2

提交回复
热议问题