const cards = ['A', 'C', 'B', 'D']; function getOriginOrder(arr){ let origin = []; let pt = arr.length - 1; for(let i = 0; i < arr.length; i++){ if(origin.length > 0){ // 牌底牌倒放 let temp = origin.pop() origin.unshift(temp) } // 桌面牌到放 origin.unshift(arr[pt]) pt-- } return origin } console.log(getOriginOrder(cards));