3. short term- memory


#1

help , it says "Oops, try again. There was a problem with your syntax." "SyntaxError: Unexpected token (

var cashRegister = {
total: 0,
add: function(itemCost){
this.total += itemCost;
}
};
//insert the add method here

scan: function (item) {

switch (item) {
case "eggs":
this.add(0.98);
break;

    case "milk": 
        this.add(1.23); 
        break;

    //Add other 2 items here
    case "magazines":
        this.add(4.99);
        break;
    case "chocolate":
        this.add(0.45);
        break;

    }
    return true;
}

};

//Scan 2 eggs and 3 magazines
cashRegiste.scan("eggs");
cashRegiste.scan("eggs");
cashRegiste.scan("magazines");
cashRegiste.scan("magazines");
cashRegiste.scan("magazines");
//Show the total bill
console.log('Your bill is '+cashRegister.total);


#2

now it says "Oops, try again. Did you remember to add cases for magazine and chocolate? Are all your prices accurate?"

var cashRegister = {
total: 0,
add: function(itemCost){
this.total += itemCost;
},

//insert the add method here

scan: function (item) {
    switch (item) { 
    case "eggs": 
        this.add(0.98); 
        break;

    case "milk": 
        this.add(1.23); 
        break;

    //Add other 2 items here
    case "magazines":
        this.add(4.99);
        break;
    case "chocolate":
        this.add(0.45);
        break;

    }
    return true;
}

};

//Scan 2 eggs and 3 magazines
cashRegister.scan("eggs");
cashRegister.scan("eggs");
cashRegister.scan("magazines");
cashRegister.scan("magazines");
cashRegister.scan("magazines");
//Show the total bill
console.log('Your bill is '+cashRegister.total);


#3

The brace is closing the object when there are still members below this point. Remove or move it to the end of the object enclosure.


#4

Should be case "magazine" not plural