Stuck at 8.Timely Matters


#1

https://www.codecademy.com/en/courses/websites-r-fun/0/8#

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();
getGreeting(now);
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”
}else{
greeting = “Abend”
}
heading.innerHTML = greeting;
return true;
}


#2

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