Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

12th edition

133544613, 978-0133544619

More Books

Students also viewed these Databases questions

Question

What is the energy of a photon if its wavelength is 5.88 104 m?

Answered: 1 week ago

Question

3. What should a contract of employment contain?

Answered: 1 week ago

Question

13-4 What are alternative methods for building information systems?

Answered: 1 week ago

Question

13-1 How does building new systems produce organizational change?

Answered: 1 week ago