8 3 1 common array methods 2f 2f reverse examples 28 reverse 29

Solutions on MaxInterview for 8 3 1 common array methods 2f 2f reverse examples 28 reverse 29 by the best coders in the world

showing results for - "8 3 1 common array methods 2f 2f reverse examples 28 reverse 29"
Astrid
04 Nov 2018
1//The general syntax for this method is:
2arrayName.reverse()
3
4/*This method is straightforward - it reverses the order of the elements
5in the array.*/
6
7//No arguments are placed inside the parentheses ().
8
9let arr = ['At', 'banana', 'orange', 'apple', 'zoo'];
10
11arr.reverse();
12console.log(arr);
13
14//[ 'zoo', 'apple', 'orange', 'banana', 'At' ]