Javascript - Write program to fix if else statement

Requirements

Write program to fix if else statement

The if/else statement does not work.

var greeting;
var hour = new Date().getHours();

if (hour < 18) {
    greeting = "Good day";
else
    greeting = "Good evening";
}

console.log( greeting );

Hint

Some curly braces are missing.

Demo

var greeting;
var hour = new Date().getHours();

if (hour < 18) {
    greeting = "Good day";
} else {/*from  w ww.  j ava2  s.com*/
    greeting = "Good evening";
}

console.log( greeting );

Result