Let's say in a javascript function I have:
function myfunction (x) {
if (x===0) {
return false; //return;
};
//some code
};
Is there a difference between return
or return false
?
I'm asking because someone advised me to use just return (and he do not explained why).
I'm using it for exit the function without doing nothing more. In this simple example I could use if (x!==0) {};
but in longer function maybe (tell me if I'm wrong) is not a good idea to have nested if statement.