-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
  • 3,195
  • 4
  • 28
  • 64

1 Answers1

0

You can use the reverse() function.

var a = ["fourth", "third", "second", "first", "zero"];
a.reverse(); 
    
console.log(a)
Isaac
  • 12,042
  • 16
  • 52
  • 116
Jerodev
  • 32,252
  • 11
  • 87
  • 108