I have some Javascript code that needs to end with either a true or false value being returned. However, when the true/false value is computed, the original value has passed through multiple functions, like so:
var txt = 'foo'
function one(txt) {
if(txt == 'foo') { two(txt); }
}
function two(txt) {
if(txt == 'foo') { three(txt); }
}
function three(txt) {
if(txt == 'foo') { return true; }
else { return false; }
}
Obviously this example has little point but it gets the general point across. What I need to do to it is return the true (or false) value from function three() all the way back to function one(), and then have function one() return that value to whatever called it. I am assuming I have to go back through function two() to get back to one, is there a way I can do this with a variable? Just an idea. Thanks very much for any help!
return two(txt);andreturn three(txt);won't work?