Answers for "js loops through array backwards"

40

js loop array backwards

let arr = [1, 2, 3];
arr.slice().reverse().forEach(x => console.log(x))
Posted by: Guest on November-03-2021
0

javascript loop backwards through array

ar arr = [1, 2, 3, 4, 5];
 
Object.keys(arr).reverse()
        .forEach(function(index) {
            console.log(arr[index]);
        });
Posted by: Guest on April-20-2022

Code answers related to "js loops through array backwards"

Code answers related to "Javascript"

Browse Popular Code Answers by Language