nebmucoy674
Coder
Again, thank you all for your help. I'm being taught a class online and HAVE to follow a If/Else script for the current project. I've tried multiple times with no success.... is it so simple I can't see it? Furthermore, is there an online resource that can check JS code pretty well with a good definition of what might be wrong with it? Thank you all again! I admire how passionate the people are that help me.
JavaScript:
<p id="daytime"></p>
<script>
const hour = new Date().getHours();
let greeting;
if (hour < 12) {
greeting = "Good Morning";
} else (hour >= 12) {
greeting = "Good Afternoon";
}
document.getElementById("daytime").innerHTML = greeting;
</script>
Last edited by a moderator: