Tell us what’s happening:
Trying to complete the challenge: Iterate over Arrays with map (#222 in my least), however, i’m stuck.
i’m sure of my code, even when I alter the last variables, switching old with new, it works in theory, but I fail because I alter the original array.
please help!
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_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36.
Link to the challenge:
https://www.freecodecamp.org/challenges/iterate-over-arrays-with-map