-1

Here's what i'm thinking about:

var a = ["fourth", "third", "second", "first", "zero"];

So now a[0] === "fourth", a[1] === "third"... and so on. I want to change the direction of the items, so they values will be equilalent to they place in the array like this: a[0] === "zero", a[1] === "first"....

Gergő Horváth
  • 2,529
  • 4
  • 19
  • 47

1 Answers1

0

You can use the reverse() function.

var a = ["fourth", "third", "second", "first", "zero"];
a.reverse(); 
    
console.log(a)
Isaac
  • 10,467
  • 12
  • 39
  • 97
Jerodev
  • 31,061
  • 11
  • 83
  • 102