I want to insert my function inside of the h1 tag so it will address the user a greeting depending on the time of day. This is my time function but how do I implement it into h1?
var today = new Date();
var curHr = today.getHours();
function greeting() {
if ( curHr < 12) {
document.write('Good Morning');
} else if ( curHr < 18) {
document.write('Good Afternoon');
} else if ( curHr < 20) {
document.write('Good Evening')
} else {
document.write('Good Night');
}
}