const array1 = [2,5,10];
const arr10 = function(arr) { arr.map(x => x * 10); };
console.log(arr10(array1));
arr10(array1); 应该返回一个数组,其中包含 array1 * 10 中的每个数字。我不明白为什么我没有定义。
你必须在函数中添加返回:
const array1 = [2,5,10];
const arr10 = function(arr) { return arr.map(x => x * 10); };
console.log(arr10(array1));
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句