Answers for "how to make a loop count backwards"

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 make a loop count backwards"

Browse Popular Code Answers by Language