Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

JavaScript Question of the Day March 3, 2025

  1. Incorrect Correct No Answer was selected Invalid Answer

    What does the following program do when a user tries to click and drag a graphic object on the canvas?

    function main() {
       mouseDownMethod(secretAction);
    }
    
    function secretAction(e) {
        let secret = getElementAt(e.getX(), e.getY());
        if (secret != null) {
            secret.setColor(Randomizer.nextColor());
        }
    }
    
    // Assume there is additional code that creates one or more graphics objects
    
    main();
    JavaScript