Reverse Arrays with reverse

Hi,

I wonder what is wrong with my code. Everything is right except this: “You should use the reverse method.”


var array = [1,2,3,4,5,6,7];
var newArray = [];

// Only change code below this line.

newArray = array.reverse(function(val){
  return val;
});

.reverse() take no parameters.

1 Like

Turn your function inside-out - put the array reverse inside the function.

1 Like

map and reduce were introduced prior to this waypoint so it makes you think reverse() follows the same syntax.

We get stuck following patterns from previous way points. Even when the correct solution is simpler.

2 Likes