Javascript Survival for Honesty and Humility Boolean Results AND  OR  NOT A B A&&B True True True True False False False T...
The if statement if ( condition )   {   code to be executed if condition is true   } Example: <html><body> <script type=&q...
The if-else statement if ( condition )   {   code to be executed if condition is true   } else   {   code to be executed i...
The if-else if-else statement if ( condition1 )   {   code to be executed if condition1 is true   } else if ( condition2 )...
Upcoming SlideShare
Loading in...5
×

Javascript survival2

559

Published on

The second part of discussion.

Published in: Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
559
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
10
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Javascript survival2"

  1. 1. Javascript Survival for Honesty and Humility Boolean Results AND OR NOT A B A&&B True True True True False False False True False False False False A B A||B True True True True False True False True True False False False A !(A) False True True False
  2. 2. The if statement if ( condition )   {   code to be executed if condition is true   } Example: <html><body> <script type=&quot;text/javascript&quot;> var d = new Date(); var time = d.getHours(); if (time < 10) { document.write(&quot;<b>Good morning</b>&quot;); } </script> <p>This example demonstrates the If statement.</p> <p>If the time on your browser is less than 10, you will get a &quot;Good morning&quot; greeting.</p></body></html>
  3. 3. The if-else statement if ( condition )   {   code to be executed if condition is true   } else   {   code to be executed if condition is not true   } Example: <html><body><script type=&quot;text/javascript&quot;> var d = new Date(); var time = d.getHours(); if (time < 10) { document.write(&quot;<b>Good morning</b>&quot;); } else { document.write(&quot;<b>Good day</b>&quot;); } </script> <p>This example demonstrates the If...Else statement.</p> <p>If the time on your browser is less than 10, you will get a &quot;Good morning&quot; greeting. Otherwise you will get a &quot;Good day&quot; greeting. </p></body></html>
  4. 4. The if-else if-else statement if ( condition1 )   {   code to be executed if condition1 is true   } else if ( condition2 )   {   code to be executed if condition2 is true   } else   {   code to be executed if condition1 and condition2 are not true   } Example: <script type=&quot;text/javascript&quot;> var d = new Date(); var time = d.getHours(); if (time<10)   {   document.write(&quot;<b>Good morning</b>&quot;);   } else if (time>10 && time<16)   {   document.write(&quot;<b>Good day</b>&quot;);   } else   {   document.write(&quot;<b>Hello World!</b>&quot;);   } </script>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×