return boolean code example
Example: Returning Boolean Values from Functions
function isLess(a, b) {
//avoid this code
if (a < b) {
return true;
} else {
return false;
}
// There is a better way to do this
return a < b;
}
function isLess(a, b) {
//avoid this code
if (a < b) {
return true;
} else {
return false;
}
// There is a better way to do this
return a < b;
}