If statement In java Script

We can use this statement if we want to execute a set of code in case the given condition is true. Let us say if today is Sunday go to market.
syntax (How it is written):

  if (condition)


job to be done if condition is found true






<script type=”text/javascript”>

var a,b;



document.write(“<br>Value of a “+a);

document.write(“<br>Value of b “+b);

if (a>b)


document.write(“<br>value of a is greater than b “);





Understanding program :
Value of a is 100 and value of b is 50. In if statement, we are checking that if a is greater than b then the message should be printed.
Value of a 100
Value of b 50
value of a is greater than b