Created
April 3, 2019 12:05
-
-
Save kudapara/b5aa1eac9f849b0bc76159603114b044 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>Comparison in javascript</title> | |
</head> | |
<body> | |
After making the comparison | |
</body> | |
<script> | |
// Convert to integer from string so that the comparison | |
// is correct for cases like 12 being seen as less that 4 | |
var a = parseInt(prompt("Insert the first number")); | |
var b = parseInt(prompt("Insert the second number")); | |
if (a > b) { | |
document.write(a + " is greater than " + b); | |
} else if (a < b) { | |
document.write(a + " is less than " + b); | |
} else { | |
document.write("they are equal"); | |
} | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment