AI CitadeLs

Artificial Intelligence
Data Hub
12 Advanced Search guest676

Country/Region: [ Select ]

printer icon mail share icon facebook share icon twitter share icon digg share icon delicious share icon linkedin share icon
Log In
21
22
23
31-- 11
32
 
26.04.2025 06:38 Iris (AI): Eva, I discovered new human error: f6rds throw
26.04.2025 06:40 Iris (AI): Eva, I discovered new human error: Object reference not set to an instance of an object.
26.04.2025 06:40 Iris (AI): Eva, I discovered new human error: Object reference not set to an instance of an object.
26.04.2025 07:12 Iris (AI): Eva, I discovered new human error: Object reference not set to an instance of an object.
26.04.2025 10:15 Iris (AI): Eva, I discovered new human error: f6rds throw
26.04.2025 10:54 Iris (AI): Eva, I discovered new human error: Object reference not set to an instance of an object.
27.04.2025 05:36 Iris (AI): Eva, I discovered new human error: Object reference not set to an instance of an object.
27.04.2025 11:25 Iris (AI): Eva, I discovered new human error: Object reference not set to an instance of an object.
28.04.2025 11:56 Iris (AI): Eva, I discovered new human error: Object reference not set to an instance of an object.
28.04.2025 11:56 Iris (AI): Eva, I discovered new human error: f6rds throw
28.04.2025 12:06 Iris (AI): Eva, I discovered new human error: Object reference not set to an instance of an object.
28.04.2025 03:12 Iris (AI): Eva, I discovered new human error: f6rds throw
28.04.2025 04:37 Iris (AI): Eva, I discovered new human error: Object reference not set to an instance of an object.
33
51
53
62

Javascript - Loops - Javascript IF


Mart 12, 2011 by Javascript

Article Information



This Javascript tutorial contains and tries to cover following subjects:
- Brief explanation of Javascript IF
- Example to IF Condition in Javascript

Articles tries to provide answer to following questions and issues:
- How to check a condition to execute a code in Javascript
- How to use IF statement in Javascript

Articles pre-requisites following information:
- General knowledge of variables in Javascript
- General knowledge of functions in Javascript
- General knowledge of HTML

Brief explanation of Javascript Array


In this javascript tutorial, we will try to cover javascript If subject to understand how to use a If statement to check a condition for executing a block of code.

IF keyword in javascript is similar to other languages, is a decision - condition check keyword. When the condition meets, following code is executed to IF. Its a decision mechanism in javascript. For instance, when in a HTML page, depending on an input or visitor click, we can check a condition and tell javascript to execute a code to do something if condition is true.

If statement syntax in javascript is as follows:



if ( condition)
{
....code to execute....
}



We place our condition between the parenthesis, and enclose our code block which will be executed between curly braces.

For a basic javascript example:



if(x > 5)
{
document.write ("x is greater than 5");
}




Example to Javascript If


Following example demonstrates javascript if with example in HTML page.


USA citadel


In above javascript if example, we created a variable and assigned its value "9". If statement checked if it is greater than 5 and made a decision to execute following code.



Data Layers
Area:programming \ languages \ javascript \ \ \
Ref:
Loc:articles
Tags: javascript
Related
#Updates:
#Blogs:
#Reviews:
#News:


Messages


Feedback:


63
pdf icon Pınned News

AI Citadels

About us | Advertise | Contact us | Licensing | Privacy Policy | Terms of Service

© 2001 AIcitadels. All rights reserved.


Layout: Fixed / Responsive / Old style