Iterate over Arrays with map not passing

Tell us what’s happening:

whats wrong with this? why isn’t it passing?

Your code so far

var oldArray = [1,2,3,4,5];

// Only change code below this line.
var newArray = oldArray.map(function(val){
  return val + 3;
});
var newArray = oldArray;

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8.

Link to the challenge:
https://www.freecodecamp.org/challenges/iterate-over-arrays-with-map

The last line assigns the same oldArray to newArray, basically undoing the mapping that you’ve done. Remove it.

1 Like