0% found this document useful (0 votes)
183 views10 pages

Javascript: Conditional Statement

This document discusses conditional statements in JavaScript. It outlines that the objective is for students to understand conditional statements. It covers if, if-else, and if-else if statements. The if statement allows JavaScript to execute code conditionally based on an expression being true. An if statement syntax and example are provided. An if-else statement syntax and example are also provided to show executing one code block if the condition is true and another if it is false. References for further information are listed at the end.

Uploaded by

Shanza khursheed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
183 views10 pages

Javascript: Conditional Statement

This document discusses conditional statements in JavaScript. It outlines that the objective is for students to understand conditional statements. It covers if, if-else, and if-else if statements. The if statement allows JavaScript to execute code conditionally based on an expression being true. An if statement syntax and example are provided. An if-else statement syntax and example are also provided to show executing one code block if the condition is true and another if it is false. References for further information are listed at the end.

Uploaded by

Shanza khursheed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

JAVASCRIPT

Conditional statement
OBJECTIVE
 Students will be able to understand the conditional statement.
OUTLINE
 control statements
 If
 if-else
 if- else if
IF-ELSE
IF-ELSE
 The ‘if’ statement is the fundamental control statement that allows JavaScript to make
decisions and execute statements conditionally. Syntax The syntax for a basic if statement is as
follows:
 Syntax
if (expression)
{ Statement(s) to be executed if expression is true }
IF EXAMPLE

output
IF-ELSE EXAMPLE
<html>
else{
<body> document.write("<b>Does not qualify
for driving</b>");
<script type="text/javascript">
}
var age = 15;
</script>
if( age > 18 ){ <p>Set the variable to different value
document.write("<b>Qualifies and then try...</p>
for driving</b>"); </body>
</html>
}
REFERENCES
 Java Script & J Query by Jon Duckett, Volume 2 (2014), ISBN-13: 978-1118531648, ISBN-
10: 9781118531648.
 W3Schools url: www.w3school.com
 TutorialsPoint url: www.tutorialpoint.com

You might also like