Passes, but gets a reference error?


#1

I input my code, and it passes, but it doesn't show an answer in the console. It just shows ReferenceError: quantity is not defined. So... this is weird, but I have no idea if I've done something wrong or not. Here's my code:
var cashRegister = {
total:0,
add: function(itemCost){
this.total += itemCost;
quantity = quantity;
},
scan: function(item, quantity) {
switch (item) {
case "eggs": this.add(0.98 * quantity); break;
case "milk": this.add(1.23 * quantity); break;
case "magazine": this.add(4.99 * quantity); break;
case "chocolate": this.add(0.45 * quantity); break;
}
}
};

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


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

Have I done something wrong, or is there something weird with the checker? Thanks.


#2

Hi in this line you wrote cashRegsiter.scan("milk", 4); instead of cashRegister.scan("milk", 4);