Hello, I have a question with the program javascript and in the program I need to create a timer in which it will give me good morning from midnight till noon, good afternoon, noon till 5pm, and good evening from 5pm till midnight. The is I have so far in the webstorm text editor: // hello.js// This is a client-side JavaScript program that tells the time.// It is meant to be embeded in a web page named "hello.html".var today = new Date()var curHr = today.getHours()if (curHr < 12) {console.log('good morning')} else if (curHr < 18) {console.log('good afternoon')} else {console.log('good evening')}function displayHello() {document.getElementById("displayArea").innerHTML= curHr + " Current time is: " + new Date();}Sorry I couldn't upload the attachment for some reason. I appreciate it though.
Hello, I have a question with the program javascript and in the program I need to create a timer in which it will give me good morning from midnight till noon, good afternoon, noon till 5pm, and good evening from 5pm till midnight. The is I have so far in the webstorm text editor: // hello.js
// This is a client-side JavaScript program that tells the time.
// It is meant to be embeded in a web page named "hello.html".
var today = new Date()
var curHr = today.getHours()
if (curHr < 12) {
console.log('good morning')
} else if (curHr < 18) {
console.log('good afternoon')
} else {
console.log('good evening')
}
function displayHello() {
document.getElementById("displayArea").innerHTML= curHr + " Current time is: " + new Date();
}
Sorry I couldn't upload the attachment for some reason. I appreciate it though.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images