JavaScript If...Else Condition Example

Example

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

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

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

Run it...   »

Example Result