Explore what CodeHS has to offer for districts, schools, and teachers.
Click on one of our programs below to get started coding in the sandbox!
View All
The following function draws a rectangle on the canvas:
function drawSquare(size, color) { let square = new Rectangle(size, size); square.setColor(color); square.setPosition(100, 100); add(square); }
What is the minimum number of arguments that must be used when calling the drawSquare() function?
drawSquare()
Four
Three
Two
You don’t actually need to include any arguments when calling this function in order to draw a square.