i have this kind of method:
function() {
if (condition) {
return true;
}
return false;
}
I thought of returning the condition itself , to make it more clean, and maybe more readable. like this:
function() {
return (condition);
}
is this considered a good practice?
3 && 4will return4). If you absolutely need a boolean, use double negation:return !!(condition);