Skip to content

Instantly share code, notes, and snippets.

@bogdanmoisin
Created June 22, 2015 09:07
Show Gist options
  • Save bogdanmoisin/bd3160367b75d3c3e9e5 to your computer and use it in GitHub Desktop.
Save bogdanmoisin/bd3160367b75d3c3e9e5 to your computer and use it in GitHub Desktop.
// Find minimum of 2 numbers
function min ( x, y ) {
if ( x < y ) {
return x;
}
else {
return y;
}
}
console.log(min(0, 10));
// → 0
console.log(min(0, -10));
// → -10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment