Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

JavaScript Question of the Day Jan. 17, 2025

  1. Incorrect Correct No Answer was selected Invalid Answer

    What is the output of the following code?

    function main() {
        let feet = 2;
        convertLength("centimeter");
        let conversion = convertLength("inch"); 
        let convertedLength = feet * conversion;
    
        console.log("Converted length = " + convertedLength);
    }
    
    function convertLength(unit) {
        let length = 0;
    
        if (unit == "inch") {
            length = 12;
        } else if (unit == "centimeter") {
            length = 30;
        }
    
        return length;
    }
    
    main();
    JavaScript