Building a Cash Register 5/7


It says oops try again false.

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


//Void the last transaction and then add 3 instead
cashRegister.add('chocolate', 3);

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


Does this line look right to you?


Yes is it wrong?? Oh am I supposed to scan instead of add?


yea that was it wow sorry in the directions it says add 3 of the same so my mind probably just wanted me to put the add method instead of the scan thanks for that.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.