Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

JavaScript Question of the Day Jan. 8, 2025

  1. Incorrect Correct No Answer was selected Invalid Answer

    The following program is meant to print the total cost of a purchase, but currently results in an error:

    function main() {
        let cost = 5;
        let count = 22;
    
        printCost(count);
    }
    
    function printCost(num) {
        let total = itemCost * num;
        console.log(total);
    }
    
    main();
    JavaScript

    Which of the below options should be implemented in order to fix the program?