Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Now the great thing about it is what it allows us to do is, if we wanted it, call this myFunction 3, 4, 5 times. Not that this is going to be very exciting, but if I save this and then I just go back to the page and reload it, what we'll have is five alert boxes. You can call a function once, you can it call it twice, you can call it a thousand times. It's a great way of creating modular code. You can even have a function call itself. This is a process called recursion, which can allow you to do some very interesting, although that's a subject for another time.
You can have as many functions as you want inside your code. You can have one function call other function, call another function, call another function. In fact, that's the general way that you will start to break up your code. So they let you have a little more control over this code and when it runs. Functions let you break apart your code into more manageable pieces, but we can take them a little further. We also want them to be able to pass information back to us, and we want to pass information into the functions when they run. So let's see that next.
Get unlimited access to all courses for just $25/month.Become a member
61 Video lessons · 92241 Viewers
82 Video lessons · 104072 Viewers
71 Video lessons · 75425 Viewers
56 Video lessons · 106806 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.