反转数组并使用reduce和concat方法避免局部变量
代码:-
var reverse = function reverse() {
let A = ["Hello", "world"];
let B = A.reduceRight((a, c) => (a.push(c), a), []);
console.log(B);
};
reverse()
答案 0 :(得分:-1)
使用reverse()
函数反转数组
var reverse = function reverse() {
let A = ["Hello", "world"];
console.log(A.reverse())
};
reverse()