4.7 Cash Register problem "cashRegister is not defined"


#1


I'm working on building a cash register : https://www.codecademy.com/courses/close-the-super-makert/0/4?curriculum_id=506324b3a7dffd00020bf661#


I'm getting this error from the console: ReferenceError: cashRegister is not defined


var cashRegister = {
    total:0,
    add: function(itemCost){
        this.total += itemCost;
    },
    scan: function(item, quant) {
        switch (item) {
        case "eggs": this.add(0.98 * quant); break;
        case "milk": this.add(1.23 * quant); break;
        case "magazine": this.add(4.99 * quant); break;
        case "chocolate": this.add(0.45 * quant); break;
        }
    }
};

// scan each item 4 times
cashRegister.scan("eggs",4);
cashRegister.scan("milk",4);
cashRegister.scan("magazine",4);
cashRegsiter.scan("chocolate",4);


//Show the total bill
console.log('Your bill is '+cashRegister.total);


#2

The error message is actually referencing the above line, and reads as,

ReferenceError: cashRegsiter is not defined


#3

Ah, such a simple typo. Thanks!!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.