I have 3 JS functions a() b() c()
I want to execute all 3 and also check if all 3 return true then I want to call function yeah() or else call function boo()
I can use && but it will short circuit and may not execute all 3 functions if first or second returns false
So
if(a() && b() && c()) { yeah(); } else { boo(); }
wouldn’t work!
Can you suggest a better single line code?
If you want a one-liner, you can also use
&instead of&&:Or you can do this if you want to know exactly how many functions returned true:
Sample: http://jsfiddle.net/DQkpM/1/