This is the solution for this exercise:
[spoiler]
var oldArray = [1,2,3,4,5];
// Only change code below this line.
var newArray = oldArray.map(function(val){
return val + 3;
});
console.log(addThree);
console.log(oldArray);
```[/spoiler]
This is the solution for this exercise:
[spoiler]
var oldArray = [1,2,3,4,5];
// Only change code below this line.
var newArray = oldArray.map(function(val){
return val + 3;
});
console.log(addThree);
console.log(oldArray);
```[/spoiler]
I cleaned up your code.
You need to use triple backticks to post code to the forum.
See this post for details.
I also added spoiler tags because this is a solution.
@annajuare, I am glad you got the solution working, but please do not create multiple threads on the same topic. Also, please remember to put a solution in a spoiler
I am going to close this thread, and I also closed your other solution thread. I kept your original thread open in case you have any more questions, or please message me if you have a question about me closing it. Again, nothing wrong with posting solution, etc. But there is no need for three threads on the same topic. Happy coding!