//The reverse() method reverses the elements in an array. const fruits = ["Banana", "Orange", "Apple", "Mango"]; fruits.reverse(); //output >> ["Mango", "Apple", "Orange", "Banana"] //if you find the answer is useful , //upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)var arr=[1,2,5,6,2] arr.reverse()array = [1 2, 3] reversed = array.reverse()const fruits = ["Banana", "Orange", "Apple", "Mango"]; fruits.sort(); fruits.reverse();// reversing an array in javascript is kinda hard. you can't index -1. // but i can show how you can do it in 4 lines. var myArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; for (var i = myArray.length - 1; i > 0; i -= 1) { myArray.shift(); myArray.push(i); } console.log(myArray); // output: [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]numArr.reverse(); strArr.reverse(); console.log(numArr); console.log(strArr); int[] xr = {1, 2, 3, 4, 5}; System.out.print("["); for (int i = xr.length - 1; i >= 0; i--) { System.out.print(xr[i] + ", "); } System.out.println("\b\b]"); }const list = [1,2,3,4,5]; list.reverse(); // It changes the original array console.log('reversed:', list); // expected output: "reversed:" Array [5, 4, 3, 2, 1]function reversArray(){ for (let i = 0; i < arr.length; i++) { for (let j = i + 1; j < arr.length; j++) { let c, a, b; b = arr[i]; arr[i] = arr[j]; arr[j] = b; } }console.log(arr); } let arr = [1, 12, 15, 16, 78, 89, 53 ,'hi']; reversArray(arr); var myArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; for (var i = 0; i < myArray.length; i++) { [myArray[i], myArray[myArray.length-1]] = [myArray[myArray.length-1], myArray[i]] } console.log(myArray); // output: [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]