Skip to content

Instantly share code, notes, and snippets.

@VenkataRaju
Last active January 1, 2016 11:27
Show Gist options
  • Save VenkataRaju/b0fd48a621ce928c13ca to your computer and use it in GitHub Desktop.
Save VenkataRaju/b0fd48a621ce928c13ca to your computer and use it in GitHub Desktop.
function minNonNegative(num1, num2)
{
if (num1 >= 0 && (num1 <= num2 || num2 < 0))
return num1;
if (num2 >= 0)
return num2;
throw new Error(`Both num1[${num1}] and num2[${num2}] are negative`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment