Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="description" content="[If Else-If Else]">
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width">
  7. <title>JS Bin</title>
  8. </head>
  9. <body>
  10.  
  11. <script id="jsbin-javascript">
  12. // If, if-Else
  13. let hour = 17;
  14.  
  15.  
  16. if (hour >= 0 && hour < 12){//Good Morning!// hour is 0-12
  17. console.log('Good Morning!');
  18. }
  19. else if (hour >= 12 && hour < 17){// hour is 12-17 //Good Afternoon!
  20. console.log('Good Afternoon!');
  21. }
  22. else if (hour >= 17 && hour < 22){// hour is 17-22 //Good Evening!
  23. console.log('Good Evening!');
  24. }
  25. else {
  26. console.log('Good Night!');// hour is 22-24 //Good Night!
  27. }
  28. </script>
  29.  
  30.  
  31.  
  32. <script id="jsbin-source-javascript" type="text/javascript">// If, if-Else
  33. let hour = 17;
  34.  
  35.  
  36. if (hour >= 0 && hour < 12){//Good Morning!// hour is 0-12
  37. console.log('Good Morning!');
  38. }
  39. else if (hour >= 12 && hour < 17){// hour is 12-17 //Good Afternoon!
  40. console.log('Good Afternoon!');
  41. }
  42. else if (hour >= 17 && hour < 22){// hour is 17-22 //Good Evening!
  43. console.log('Good Evening!');
  44. }
  45. else {
  46. console.log('Good Night!');// hour is 22-24 //Good Night!
  47. }
  48. </script></body>
  49. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement