JavaScript -Schleife durch Array rückwärts
let arr = [1, 2, 3];
arr.slice().reverse().forEach(x => console.log(x))
Friendly Hawk
let arr = [1, 2, 3];
arr.slice().reverse().forEach(x => console.log(x))
import pyautogui
pyautogui.click(100, 100)
pyautogui.moveTo(100, 150)
pyautogui.moveRel(0, 10) # move mouse 10 pixels down
pyautogui.dragTo(100, 150)
pyautogui.dragRel(0, 10) # drag mouse 10 pixels down
# Using Array.prototype.reduceRight() function
var arr = [1, 2, 3, 4, 5];
arr.reduceRight((_, item) => console.log(item), null);
# Using Array.prototype.reverse() function
var arr = [1, 2, 3, 4, 5];
arr.slice().reverse()
.forEach(function(item) {
console.log(item);
});
# Alternatively, you can use the Object.keys() method to get keys:
var arr = [1, 2, 3, 4, 5];
Object.keys(arr).reverse()
.forEach(function(index) {
console.log(arr[index]);
});
# Using reverse for-loop
# The standard approach is to loop backward using a for-loop starting from the end of the array towards the beginning of the array.
var arr = [1, 2, 3, 4, 5];
for (var i = arr.length - 1; i >= 0; i--) {
console.log(arr[i]);
}
const array = ['alpha', 'beta', 'gamma'];
array.reduceRight((_, elem) => console.log(elem), null);
Run code snippet
const arr = [1, 2, 3];
const newArray = arr.slice().reverse().map(x => x);
console.log(newArray);
const array = ['alpha', 'beta', 'gamma'];
array.reduceRight((_, elem) => console.log(elem), null);
var arr = [1, 2, 3, 4, 5];
for (var i = arr.length - 1; i >= 0; i--) {
console.log(arr[i]);
}
let arr = [1, 2, 3];
arr.slice().reverse().forEach(x => console.log(x))