3. Short-Term Memory - return true;



i want to ask why the "return true" is necessary in the scan function.

scan: function (item) {
        switch (item) { 
        case "eggs": 
        case "milk": 
        //Add other 2 items here
        case "magazine": 
        case "chocolate": 
        return true; // why is this code necessary here?


What makes you say that it's required?
Be careful with how you treat assumptions, treating them as unconditional facts will lead you to questions and conclusions that don't make sense or don't add up.


sorry, i do not get what you mean.

the "return true;" code is given in the exercise.( i didn't create that line of code) So i am asking why that line of code is necessary or,

in other words, what is the rationale behind in writing this line of code which is in the scan function.


Was there by default, I see.
Still can't start with the assumption that it's required though!
So the question then is whether it's used for anything.
Doesn't appear that way. All calls to it ignore what it returns.


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