5. please help


var cashRegister = {
    //Dont forget to add your property
    add: function(itemCost) {
        this.total +=  itemCost;
        lastTransactionAmount = 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;
        return true;
    //Add the voidLastTransaction Method here
    voidLastTransaction: function() {
        this.total -= lastTransactionAmount;


//Void the last transaction and then add 3 instead

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

the error i keep getting is false , id ont know what to do i tried everything please help. thanks.

and another questin offtopic, any1 who understand more in javascript: the last transaction was chocolate, 4 times chocolat, if i want to void last transaction and i want to remove only 1 chocolate how i can do this? and 1 last this why is there in the scan method return true; what is that for? thanks for the help


Which error are you getting? The output in the console from the code is

"Your bill is 22.17"


yes this is the bill it prints but still getting opps false


ok i found the mistake, the instruction wanted 3 more chocolate and not 3 more magazine, but i have edit some more questions if some1 can answer me please. thanks!