Skip to content

Instantly share code, notes, and snippets.

@DanishSiddiq
Last active March 5, 2021 04:44
Show Gist options
  • Save DanishSiddiq/86060ba889234d7cbc1aa0ce3990840e to your computer and use it in GitHub Desktop.
Save DanishSiddiq/86060ba889234d7cbc1aa0ce3990840e to your computer and use it in GitHub Desktop.
Complicated Code Structure
function calculateSomeFormula(param1, param2) {
if (param1) {
if (!isNaN(param1)) {
if (param2) {
if (!isNaN(param2)) {
return (param1 * 2) * (param2 * 3);
} else {
throw new Error('Param2 is not a number');
}
} else {
throw new Error('Param2 is not defined');
}
} else {
throw new Error('Param1 is not a number');
}
} else {
throw new Error('Param1 is not defined');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment