If-else statements define two blocks of code. One that is executed only when a condition is true, and the other when the condition is false.
<!DOCTYPE html>
<html>
<head>
<title>XoaX.net's Javascript</title>
</head>
<body>
<script type="text/javascript" src="IfElseStatements.js"></script>
</body>
</html>var dX = 3.8;
if (dX > 5) {
document.writeln(dX + " > 5<br />");
} else {
document.writeln(dX + " <= 5<br />");
}© 20072025 XoaX.net LLC. All rights reserved.