(3/4) I have to scan it more than once? - Right output, but failing test


Hi everyone,

I am running into an issue where I get the error "Oops, try again. It doesn't seem like your 'quantity' actually works!". However, the correct output is showing in the console. I've been checking for any possible typos or logic errors, but I cannot find the issue.

Is any one else having this issue?

Here is my code for reference:

var cashRegister = {
    add: function(itemCost){
        this.total += itemCost;
    scan: function(item, quantity) {
        switch (item) {
        case "eggs": this.add(0.98 * quantity); break;
        case "milk": this.add(1.2 * 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 '+cashRegister.total);

And here is the link to the lesson: https://www.codecademy.com/courses/close-the-super-makert/0/4?curriculum_id=506324b3a7dffd00020bf661#

Thank you.


give milk a VALUE of 1.23 instead of your 1.2


That worked! Much appreciated for the advice.


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