Answers for "How to go backwards in a for loop"

PHP
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 ]
Posted by: Guest on December-21-2020

Code answers related to "How to go backwards in a for loop"

Browse Popular Code Answers by Language