reverse an array in javascript without reverse function code example
Example 1: array reverse in javascript
var arr = [1, 2, 3, 4, 5, 6, 7];
console.log (arr.reverse ());
for (i = 0; i < arr.length / 2; i++) {
var temp = arr[i];
temp =arr[arr.length - 1 - i];
temp = temp;
}
console.log (arr);
Example 2: array reverse in javascript
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.reverse();