Javascript – How to iterate the sequence of pulling array items from middle (eg:[0,1,2,3,4,5,6,7] -> 4 3 5 2 6 1 7 0) without generating the sequence number array?
For example, when pulling items from the middle of the array : [0,1,2,3,4,5,6,7] (length is 8) const arr=[0,1,2,3,4,5,6,7]; while(arr.length>0){ document.write(arr.splice(arr.length/2,1)+" "); } the order of index of items that would pull is : 4 3 5 2 6 1 7…