js loop array backwards

154

js loop array backwards -

let arr = [1, 2, 3];
arr.slice().reverse().forEach(x => console.log(x))

js loop backwards -

var arr =  [1, 2, 3, 4, 5];
 
for (var i = arr.length - 1; i >= 0; i--) {
    console.log(arr[i]);
}

loop backwards array javascript -

var arr = [1, 2, 3, 4, 5];
 
for (var i = arr.length - 1; i >= 0; i--) {
    console.log(arr[i]);
}

js loop array backwards -

var arr = [1, 2, 3, 4, 5];
 
for (var i = arr.length - 1; i >= 0; i--) {
    console.log(arr[i]);
}

js loop array backwards -

let arr = [1, 2, 3];

arr.slice().reverse().forEach(x => console.log(x))

js loop array backwards -

let arr = [1, 2, 3];

arr.slice().reverse().forEach(x => console.log(x))
 Run code snippet

Comments

Submit
0 Comments