修改函数以相反的顺序返回给定数组的副本

时间:2019-07-17 05:37:54

标签: javascript arrays reverse

function copyAndReverseArray(array) {

}

/* Do not modify code below this line */

const original = [1, 2, 9, 8];
const reversed = copyAndReverseArray(original);
console.log(original, '<-- should still be [1, 2, 9, 8]');
console.log(reversed, '<-- should be [8, 9, 2, 1]');

我已经尝试了一段时间了。

0 个答案:

没有答案