Please enable JavaScript to use CodeHS

Chapter 1

Basic JavaScript and Graphics

1.6 Using Graphics in JavaScript

The Coordinate System

Creating Text

Make a Circle

Make a Rectangle

8 Ball

Check Your Understanding

  1. Incorrect Correct No Answer was selected Invalid Answer

Exercise: Flag of the Netherlands

Exercise: Snowman

Vocabulary

Term Definition
Constant A variable in a program that has a value that does not change.
Magic Number A number in your code that appears arbitrary. These should all be replaced with calculations or constants.
Canvas The screen in which our graphics programs are drawn.
Coordinate system A coordinate system uses numbers as coordinates to place objects in a geometric space.
getWidth() JavaScript function that returns the width of the graphics canvas
getHeight() JavaScript function that returns the height of the graphics canvas
Radius The length between the center and edge of a circle