In Chapters 1 and 2 we learned about variables and math operations that we can use in JavaScript. In this chapter, we will put that knowledge to use.
Setup
Let’s first create a couple of shapes to have something to work with. Using the ellipse and rect functions, let’s create a shape that roughly resembles a cart (Listing 4-1 and Figure 4-1).