Which fix removes the bug?
function double(arr) {
return arr.map(x => x * 2)
}
console.log(double(5));
- Change
x * 2tox + 2 - Use
forEachinstead ofmap - Pass an array like
double([5]) - Remove the arrow function
map works on arrays, so pass [5] not the number 5.