What’s Next

Functions are very powerful tools for JavaScript programmers. As we saw, the two main reasons to use a function are for reuse and for making code easier to read. We created a logMessage function so that we could use its functionality over and over again. We created the makeLog function to move a whole bunch of messy code out of the way of more important code. We even took a peek at some of the crazy things that we can do with functions, like recursion.

And we’re still just scratching the surface!

As you’ll see shortly, we’ll use functions a lot in the upcoming chapters. Let’s get started in the next chapter as we teach our avatar how to move its hands and feet!

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.