Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="description" content="[If Else-If Else]">
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>JS Bin</title>
- </head>
- <body>
- <script id="jsbin-javascript">
- // If, if-Else
- let hour = 17;
- if (hour >= 0 && hour < 12){//Good Morning!// hour is 0-12
- console.log('Good Morning!');
- }
- else if (hour >= 12 && hour < 17){// hour is 12-17 //Good Afternoon!
- console.log('Good Afternoon!');
- }
- else if (hour >= 17 && hour < 22){// hour is 17-22 //Good Evening!
- console.log('Good Evening!');
- }
- else {
- console.log('Good Night!');// hour is 22-24 //Good Night!
- }
- </script>
- <script id="jsbin-source-javascript" type="text/javascript">// If, if-Else
- let hour = 17;
- if (hour >= 0 && hour < 12){//Good Morning!// hour is 0-12
- console.log('Good Morning!');
- }
- else if (hour >= 12 && hour < 17){// hour is 12-17 //Good Afternoon!
- console.log('Good Afternoon!');
- }
- else if (hour >= 17 && hour < 22){// hour is 17-22 //Good Evening!
- console.log('Good Evening!');
- }
- else {
- console.log('Good Night!');// hour is 22-24 //Good Night!
- }
- </script></body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement