The output seems to be correct too but still getting an error msg from Codecademy not the compiler


This is that cash register exercise

I am getting an error saying: looks like your 'quantity is not working'

var cashRegister = {
    add: function(itemCost){ += itemCost;
    scan: function(item, quantity) {
        for(var i=1;i<(quantity+1);i++){
            switch (item) {
                case "eggs": this.add(0.98); break;
                case "milk": this.add(1.23); break;
                case "magazine": this.add(4.99); break;
                case "chocolate": this.add(0.45); break;

cashRegister.scan("eggs" , 4);
cashRegister.scan("milk" , 4);
cashRegister.scan("magazine" , 4);
cashRegister.scan("chocolate" , 4);

console.log('Your bill is '+ cashRegister["total"]);


if you want to help you better and faster, you should insert link of course or exact name of course + error message (fully) in here

now i think this not need
for(var i=1;i<(quantity+1);i++){
after remove it and that end block }
after that you must remove another } again

the other is here: this.add(0.98) , and other cases.
must be change to this.add(0.98 * quantity)

may be this help to you