loop backwards code example
Example 1: Count Backwards With a For Loop
var myArray = [];
for (var i = 9; i > 0; i -= 2){
myArray.push(i);
}
console.log(myArray); // console output [ 9, 7, 5, 3, 1 ]
Example 2: reverse for loop
for (int i = myArray.Length - 1; i >= 0; i--)
{
// Do something ...
}