JavaScript Multiple If...Else Condition Example

Example

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>JavaScript IF...Else IF Condition</title>
</head>
<body>
<pre>
<script type="text/javascript">

    var a = 10, b= 10;
    if (a > b) {
        document.write("a is bigger than b");
    } else if (a == b) {
        document.write("a is equal to b");
    } else {
        document.write("a is smaller than b");
    }

</script>
</pre>
</body>
</html>

Run it...   »

Example Result