Chapter 5Functions: Use and Use Again
When you’re done with this chapter, you will
-
Understand a superpowerful tool (functions) for programmers
-
Know two reasons to use functions
-
Recognize some common JavaScript errors and know how to fix them
We’ve come across functions more than once. Most recently we saw them in Chapter 4, Project: Moving Avatars, where we used them to make a forest. If you were paying close attention, you may have noticed that we also used a function to build the keyboard event listener in the same chapter.
Although we have used functions already, we haven’t talked much about them. You may already have a sense that they are pretty powerful, so let’s take a closer look now.
We’re not going to talk about every aspect of ...
Get 3D Game Programming for Kids now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.