[Solved] How to make Butterfly Shuffle in Javascript? [closed]


try this code

var a = "0,1,2,3,4,5,6,7,8,9";
var arr = a.split(',');
var arrA = [];
var arrB = [];
for (var i = 0; i < arr.length; i += 2) {
  arrA.push(arr[i]);
}
for (var i = 1; i < arr.length; i += 2) {
  arrB.push(arr[i]);
}
arrA.reverse();
var res = arrA.concat(arrB);
res.reverse();
console.log(res.toString());

solved How to make Butterfly Shuffle in Javascript? [closed]