const array1 = [2,5,10];
const arr10 = function(arr) { arr.map(x => x * 10); };
console.log(arr10(array1));
arr10(array1); should return an array with every number inside array1 * 10. I don't understand why I get undefined.
you have to add return in function:
const array1 = [2,5,10];
const arr10 = function(arr) { return arr.map(x => x * 10); };
console.log(arr10(array1));
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments