// reversing an array in javascript is kinda hard. you can't index -1.
// but i can show how you can do it in 4 lines.
var myArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
for (var i = myArray.length - 1; i > 0; i -= 1) {
myArray.shift();
myArray.push(i);
}
console.log(myArray); // output: [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]