Last active
September 17, 2022 17:42
-
-
Save kosalvann/c62bc333cad7a0bfc209 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
Thanks man for the idea. I just caught it.