Array Reverse in JavaScript
Level 269 keystrokes
reverse() reverses an array in place and returns the reversed array.
JavaScript code
// Create an array with three numbers1let nums = [1, 2, 3];// reverse() reverses the array in place (modifies original)// Returns the reversed array [3, 2, 1]2console.log(nums.reverse());// The original array is also modified3console.log(nums);Output
[ 3, 2, 1 ] [ 3, 2, 1 ]
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this JavaScript code and how often they appear.
;× 3.× 3(× 3)× 3,× 2[× 1]× 1=× 1