JS Conditionals

JS Conditionals - CS170:JSIfstatementspart1...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 170: JS If statements part 1 http://eden.rutgers.edu/~chenglii/cs170/
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Recap Javascript Variable, operator, loops
Background image of page 2
the Confirm Function Syntax: confirm ("a question you need to ask the  user");
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Conditional Statements the  'if'  statement Syntax: if(<Boolean expression>) { <then-statement>; <then-statement2>; <then-statment2>; } <Boolean expression> an expression with an outcome of either true or false. <then-statement>  (one or zero) or more JavaScript statements. depends on how we use brackets Always use the curly braces  (  { and }  ) for your if- statements.
Background image of page 4
If-Else Statements Allows execution of a set of statements if a  condition is true and another set of statements if  condition is false if (<Boolean expression>) { <then-statement>; <then-statement2>; <then-statment2>; } else { <else-statement>; }
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
“if – else if – else” Basic Structure:
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 9

JS Conditionals - CS170:JSIfstatementspart1...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online