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
Consider the following program:
function main() { let ball = createCircle(50, 200, 100, "green"); // CODE GOES HERE } function createCircle(radius, x, y, color) { let circ = new Circle(radius); circ.setPosition(x, y); circ.setColor(color); add(circ); return(circ); } function changeBall(ball) { ball.setColor("red"); } main();
Which option below, when entered on line 3, will result in a red ball added to the canvas?
changeBall();
changeBall(ball);
changeBall(ball)
ball.changeBall();
ball.changeBall()
Implementing options A or B would result in a red ball.