// Original array
let arr = [1, 2, 3, 4, 5];
// Display the original array
console.log('Original Array:', arr);
// Reverse the array in place
arr.reverse();
// Display the reversed array
console.log('Reversed Array:', arr);
code
JavaScript Reverse Array
This JavaScript code demonstrates how to reverse the elements of an array using the reverse method. The comments provide explanations for each part of the code.
Array Reversal
Reverse Method