Iterate over Arrays with map need Help

Iterate over Arrays with map need Help


What is wrong with this code? I’ve check similar topics and have tried shown solutions but still can’t pass the test. Shows error (“You should add three to each value in the array.”)

My code:

var oldArray = [1,2,3,4,5];
//only change code below this line
var newArray = {
  return val + 3;


var newArray = oldArray;


I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.

You’re reassigning newArray at the last line.


Thank you! Now it passed


Remove the last line.

You create a new array with each value added to three, but then you set the new array equal to the old array which will overwrite the new array.