Short-Term Memory


#1

Does someone know what is the "return true" in the scan function is for?

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);

    //Add other 2 items here


    }
   ** return true;**
}

#2

I'm no expert in JS.. but I'm aware the return function stops the call to function so once called it would stop the scan function..

Maybe an expert could provide a more in-depth answer but I'm sure it's to tell the program to cease firing :slight_smile: