02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

reverse

If we ever want to reverse everything its just one line away.

Video Transcript

00:00I've deleted all of our previous examples, left out just the functions and our two arrays.
00:06And I just wanted to show one more method before we call it a day for arrays for now.
00:11And obviously there's a lot of other stuff we could do with arrays that we didn't get a chance to.
00:15And I really didn't want this course to take much longer because I wanted us to
00:20have a chance to enjoy a bit of visuals and then get back to arrays and all
00:25other details of the different elements that we kind of skipped in this intro.
00:30But I think at this point, you really know what arrays are. And that's really the main objective
00:34of this video. And I think at this point, you could use arrays, and you should be comfortable
00:39with seeing them and playing with them and changing things. So let's trace out let's just
00:45show one more method. And this one method is called reverse a users dot reverse. Very simple,
00:51all it really does is takes our user list and just reverses it. So now if I trace out
00:57our a users, and I run it, we should see that now our it is first, and it actually took our array
01:07and physically switched it around. Now our example probably wouldn't be complete if we
01:13wouldn't switch our a user level as well. Now obviously, in this scenario, there isn't
01:21a lot of usage to this. But in a lot of scenarios, you'll you'll encounter that suddenly
01:26reverse is very useful to have. And here we go. So everything has been switched. So Ben true,
01:38Dan false, I'm just going from the back to make sure and here we go. Everything is exactly
01:42the opposite of what it was before.

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!