JavaScript Basic Series (v) Conditional statements (conditional statements)

Source: Internet
Author: User

If is one of the common syntax for Flash, its format is as follows

if (Coditon) statement1 (Else Statement2)

Where Coditon can be any expression, not even a real Boolean value, because JavaScript automatically converts it to a Boolean value.

If the conditional execution result is true, Statement1 is executed, and if the condition is false, the result Statment2 is executed (if Statement2 exists, else is not required)

Each conditional statement can be a single line of code, or it can be a block of code. Here's a simple example.

    var inumber = number (Prompt ("Please enter a digit between 5 and 100");     if (IsNaN (inumber))     document.write ("You make sure you enter the number. ");     Else if (Inumber > | | inumber < 5 )    document.write ("The value you entered is not in range");     Else     document.write ("The value you entered is" + inumber);

JavaScript Basic Series (v) Conditional statements (conditional statements)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.