$ ./guess_the_languageProblem Solving — fix the bug
Problem Solving — fix the bug · easy · #16

Which fix removes the bug?

function double(arr) {
  return arr.map(x => x * 2)
}
console.log(double(5));
  1. Change x * 2 to x + 2
  2. Use forEach instead of map
  3. Pass an array like double([5])
  4. Remove the arrow function
map works on arrays, so pass [5] not the number 5.
Play Problem Solving ▸