Last active
January 1, 2016 11:27
-
-
Save VenkataRaju/b0fd48a621ce928c13ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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