5.5.1 If…else Statements

If…else  statement performs an indicated action only when the condition n evaluates to true; otherwise that action is skipped.  The if…else selection statement allows you to specify that a different action is  to be performed when the condition is true than when the condition is false.


If (condition)
Code to be executed if condition is true
code to be executed if condition is not true
× Forgetting one or both of the braces that delimit a block can lead to syntax error or logic error

 <script type = “text/ javascript”>
 Marks = 60;
 If (marks>60) 
Document.write (“you have passed!”); 
else {
 Document.write (“you failed”);
Sign-up for our email newsletter and get free job alerts, current affairs and GK updates regularly.
Subscribe Here (or)

Leave a Reply

Your email address will not be published. Required fields are marked *

− 2 = three

Popup Dialog Box Powered By : XYZScripts.com
  • RSS
  • Facebook
  • Google+
  • Twitter