Better code structure reduce nested if else is to handle error condition first
// Check version eample
function CheckVersion(major, minor, patch) {
if (!(major >= 6)) {
return false;
}
// Catch 6.0.x
if (major == 6 && minor == 0 && !(patch >= 1)) {
return false;
}
return true;
}
No comments:
Post a Comment