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 program will result in an error when run:
function main() { let planet = createCircle(50, 100, 100, "blue"); planet.setColor("orange"); } function createCircle(radius, x, y, color) { let circ = new Circle(radius); circ.setPosition(x, y); circ.setColor(color); add(circ); } main();
Choose the option below that will result in this canvas output:
Rename the variable on lines 2 and 3 from planet to circ.
planet
circ
Add the code return(circ) after line 10 in the createCircle() function.
return(circ)
Delete the main() function, leaving only the createCircle() function.
Changing the main() function to be:
function main() { createCircle(50, 100, 100, "blue"); circ.setColor("orange"); }