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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!