Syntax error!


#1

this is my code and its not running
var cashRegister = {
total:0,
add: function(itemCost){
this.total += itemCost;
}

scan: function(item){
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;
}
return true;
}
};
cashRegister.scan("Eggs");
cashRegister.scan("Magazine");
cashRegister.scan("Milk");
//call the add method for our items

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


#2

An object is one or more properties separated from each-other by a comma-,.
The total-property and add-property are separated by a comma-,
You forgot the comma-separator between the add-property and the scan-property.