11 OBJECT-ORIENTED PONG

In the previous chapter we built our own version of the game Pong. Earlier, in Chapter 6, you learned about classes and object-oriented programming in JavaScript. You might be wondering why we didn’t use any classes for our implementation of Pong. The main reason was that I wanted to keep the game code as simple as possible, without including any unnecessary concepts, to make it easier to see what the actual game is doing. As programs get larger and more complex, however, it helps to give them more structure, and one common way to do that is to use object-oriented programming.

To help you get a better understanding ...

Get JavaScript Crash Course 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.