Reverse Arrays with reverse method

Reverse Arrays with reverse method
0

#1

Tell us what’s happening:
Why does this not work? I have assigned the reversed array to newArray using the reverse method and the objective was to use the reverse method. I clearly did.

Please help. I have been stuck on this problem for far too long. I get the reversed array but still cannot move on.

Your code so far

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

// Only change code below this line.

newArray = array.reverse(function(a, b){
  return b < a;
});

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36.

Link to the challenge:


#2

reverse() does not take any arguments.


#3

Ben, when I remove the arguments and function, it returns "function reverse() {[native code]}


#4

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

// Only change code below this line.

var newArray = array.reverse();

Aha! I got it. Thank you for the guiding light Ben!