Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

JavaScript Question of the Day April 8, 2025

  1. Incorrect Correct No Answer was selected Invalid Answer

    What is outputted to the canvas when the following program is run?

    function main() {
        let square = createSquare(50, 200, 100, "orange");
        changeSquare(square);
    }
    
    function createSquare(size, x, y, color) {
        let rect = new Rectangle(size, size);
        rect.setPosition(x, y);
        rect.setColor(color);
        add(rect);
        return(rect);
    }
    
    function changeSquare(square) {
        let size = square.getWidth() + 50;
        square.setSize(size, size);
        square.setColor("red");
    }
    
    main();
    JavaScript