-2

I need to know if exits some incorporated method in Javascript that turn from back to front a array or I have to create it

example

var fruits = ["Banana", "Orange", "Apple", "Mango"];

to

var fruits = ["Mango","Apple","Orange","Banana"];
Cᴏʀʏ
  • 105,112
  • 20
  • 162
  • 194
daniel barrera
  • 347
  • 1
  • 4
  • 15
  • Duplicate of http://stackoverflow.com/questions/5276953/what-is-the-most-efficient-way-to-reverse-an-array-in-javascript – Etheryte Dec 04 '14 at 23:04
  • 1
    The title of your question does not match the content. Do you want to impose an ordering based on the values in the array, or do you simply want to reverse the existing order? – Pointy Dec 04 '14 at 23:06

1 Answers1

5

You could just use the reverse method.

var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.reverse();

Please have a look at this fiddle.

Cᴏʀʏ
  • 105,112
  • 20
  • 162
  • 194
Christos
  • 53,228
  • 8
  • 76
  • 108