Question
JAVASCRIPT IT SHOULD RUN ON WEBSTORM Modify this program and make the greetings to be Good Morning, Good Afternoon and Good Evening according to the
JAVASCRIPT IT SHOULD RUN ON WEBSTORM
Modify this program and make the greetings to be Good Morning, Good Afternoon and Good Evening according to the same logic as in Part One of this lab.
Midnight till noon: Good morning (midnight inclusive, noon exclusive)
Noon till 5:00 PM: Good afternoon (noon inclusive, 5:00 PM exclusive)
5:00 PM till midnight: Good evening (5:00 PM inclusive, midnight exclusive)
var http = require('http');
var server = http.createServer(function (request, response) {
var now = new Date();
response.write("Hello there! Current time is " + now);
response.end();
});
server.listen(3333);
console.log("Server is running at http://localhost
Please modify the code above do not send the code below it doesnt work.
function displayHello(){
var myDate = new Date();
var hrs = myDate.getHours();
var greet;
if (hrs < 12)
greet = 'Good Morning';
else if (hrs >= 12 && hrs <= 17)
greet = 'Good Afternoon';
else if (hrs >= 17 && hrs <= 24)
greet = 'Good Evening';
document.getElementById('displayArea').innerHTML =
"" + greet + " Current Time Is: "+new Date();
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started