Please enable JavaScript to use CodeHS

CodeHS Glossary


rect(x, y, w, [h]) JavaScript

Draws a rectangle to the screen given the x, y coordinate and the width and height (height is optional). A rectangle is a four-sided closed shape with every angle at ninety degrees. By default, the first two parameters set the location of the upper-left corner, the third sets the width, and the fourth sets the height.