Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

JavaScript Question of the Day Jan. 31, 2025

  1. Incorrect Correct No Answer was selected Invalid Answer

    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();
    JavaScript

    Which option below, when entered on line 3, will result in a red ball added to the canvas?