文章 评论 浏览 28
let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] function reduction(arr) { let newArr = [...arr],res = [] while (newArr.length) res.push(!(newArr.length % 2) ? newArr.shift() : newArr.pop()) return res.concat(newArr).reverse() } let res = reduction(arr) console.log(res)
@bosens-China 我的理解应该是用于判断浏览器兼容性
小菜来了,膜拜maya大神
文章 0 评论 0
接受
第 126 题:扑克牌问题