Is there a shorthand way of doing this so that the outcome is always true or false?
function trueFalse() {
if( a == 1 ) {
return true;
} else {
return false;
}
}
Something like return true:false; and no need for the else section?
Thanks.
That would be:
function trueFalse(){
return a === 1;
}
Also, as much as possible, use strict comparison.