Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

JavaScript Question of the Day Feb. 6, 2025

  1. Incorrect Correct No Answer was selected Invalid Answer

    In the following code:

    let ball;
    
    function main() {
        ball = new Circle(20);
        add(ball);
        setTimer(draw, 20);
    }
    
    function draw() {
        ball.move(2, 2);
    }
    
    main();
    JavaScript

    Which of the following statements are true about ball?
    Iball is a local variable
    II – the ball variable in draw is different from the ball variable in main
    IIIball is a global variable
    IVball’s scope includes both main and draw