How is decision-making done in JavaScript?

Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.

How is decision-making done in JavaScript?

Rating:

JavaScript programs frequently have to make decisions based on the current values of variables or objects. Such decisions can have only two values: true or false. This decision-making is done with the help of the if...else statements.

The following are the syntaxes of using the if...else statements:

  • The if statement


  • if(condition)
    {
     //statements
    }


  • The if-else statement


  • if(condition)
    {
     //statements
    }
    else
    {
     //statements
    }


  • The if-else if statement


  • if(condition)
    {
     //statements
    }
    else if()
    {
     //statements
    }
    else
    {
     //statements
    }
Note: A programmer can use as many else if statements as needed.


Rating:



Other articles

Click here to Article home

 
uCertify.com | Our Company | Articles | Privacy | Security | Contact Us
MCSE: MCSA, MCTS, MCITP    JAVA Certification: SCJP, SCWCD Cisco Certification: CCNA, CCENT, A+, Network+, Security+
Oracle Certification: OCP 9i, OCP 10g, OCA 9i, OCA 10g CIW foundation    EC-212-32    CISSP    Photoshop ACE    Adobe Flash ACE
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.