Code should work


have tried a couple different variations of code that should work and have worked for others. am i missing something? this is my most recent attempt:

var cashRegister = {
add: function(itemCost){ += itemCost;
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);
cashRegister.scan("milk", 4);
cashRegister.scan("magazine", 4);
cashRegister.scan("chocolate", 4);

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


Please tell us what lesson this is, as well as the error message you are getting. Thank you.


Sorry, it's Java Script lesson 31-3, "Short-term Memory." The error message reads:"Oops, try again. Did you remember to add cases for magazine and chocolate? Are all your prices accurate? "


The above code is copied from the wrong exercise.