-1

Is it possible I can get outputs : five four three two one

Here is my example Code

 var arr = ['one','two','three','four','five'];
    $.each(arr, function (index, value) {
      console.log(value);
    });

//now i am getting Outputs: one two three four five

Any ideas, guys?

Vicky
  • 21
  • 5

1 Answers1

1

var arr = ['one','two','three','four','five'];
    $.each(arr.reverse(), function (index, value) {
      console.log(value);
    });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
Maju
  • 616
  • 4
  • 9