-
-
Save DannyMichaels/217943b080c0d1e909ad46f0c2c3417d to your computer and use it in GitHub Desktop.
Define a function max() that takes two numbers as arguments and returns the largest of them. Use the if-then-else construct available in Javascript.
This file contains 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
// Define a function max() that takes two numbers as | |
// arguments and returns the largest of them. Use the | |
// if-then-else construct available in Javascript. | |
// https://jsfiddle.net/ryjtyomv/ | |
function max(firstNum, secondNum){ | |
if (firstNum > secondNum) { | |
console.log(firstNum + " is larger than " + secondNum); | |
} else { | |
console.log(firstNum + " is less than " + secondNum); | |
} | |
return; | |
} | |
// Lets set two numbers | |
max(142,234); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment