1
00:00:00,120 --> 00:00:03,920
We can sort an array alphabetically using this sort method.

2
00:00:04,320 --> 00:00:08,570
This sample script includes an array variable named cars.

3
00:00:08,610 --> 00:00:10,820
There are four elements in the array.

4
00:00:10,950 --> 00:00:15,590
Volvo Acura Honda and Lexus.

5
00:00:15,620 --> 00:00:21,440
Let's go ahead and add the sort method into the script to sort the elements alphabetically from A to

6
00:00:21,440 --> 00:00:24,770
Z.

7
00:00:25,080 --> 00:00:29,930
We start with the variable name cars and then enter the sort method

8
00:00:33,810 --> 00:00:37,140
we'll save our file and preview it in our web browser to make sure it worked.

9
00:00:39,340 --> 00:00:46,680
We can see here that each array element is now sorted in alphabetical order

10
00:00:52,210 --> 00:00:58,900
we can also reverse sought the elements in an array using the reverse method to do so simply type the

11
00:00:58,900 --> 00:01:12,330
following line of code into your script.

12
00:01:12,340 --> 00:01:17,790
Now when we refresh the page you'll notice that each element item is in reverse order.
