Stuck at 8.Timely Matters

Oops, try again. Your greeting should change for different times of day!


I really don’t know what’s wrong with my code, since as far as I can tell it does exactly what is required to pass the exercise.

window.onload = function() {
var now = new Date();
return true;

function getGreeting(date) {
var greeting = “”
var heading = document.getElementById(“greeting”);
if(date.getHours() < 12){
greeting = “Morgen”
}else if(date.getHours() == 12){
greeting = “Mittag”
greeting = “Abend”
heading.innerHTML = greeting;
return true;

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.