Drawing Rectangles

To help explain how to work with rectangles, let’s work together on a simple example. First, make sure you have a canvas element defined in your HTML page, and give it an id of myCanvas. To help you out with this, here is what my HTML looks like:

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy