Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

JavaScript Question of the Day Jan. 16, 2025

  1. Incorrect Correct No Answer was selected Invalid Answer

    What is the output of the following program?

    function main(){
        let x = 2;
        let firstSum = sum(x, 2);
    
        let secondSum = sum(firstSum, firstSum);
        console.log(firstSum + “ and “ + secondSum);
    }
    
    function sum(first, second){
        let result = first + second;
        return result;
    }
    
    main();
    JavaScript