js array reverse
To reverse an array in JavaScript, you can use the reverse() method. Here's an example:
var array = [1, 2, 3, 4, 5];
console.log(array); // [1, 2, 3, 4, 5]
array.reverse();
console.log(array); // [5, 4, 3, 2, 1]
The reverse() method modifies the original array by reversing the order of its elements.
原文地址: https://www.cveoy.top/t/topic/hJ18 著作权归作者所有。请勿转载和采集!