Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

JavaScript Question of the Day Feb. 10, 2025

  1. Incorrect Correct No Answer was selected Invalid Answer

    Consider the following code:

    let ball;
    let square;
    
    function main() {
        ball = new Circle(20);
        ball.setPosition(200, 200);
        setTimer(drawBall, 5000);
    
        square = new Rectangle(50, 50);
        square.setPosition(100, 100);
        drawSquare();
    }
    
    function drawBall() {
        add(ball);
    }
    
    function drawSquare() {
        add(square);
    }
    
    main();
    JavaScript

    Which object will be added to the screen first?