Basic Javascript algorithm for time implementation (morning, afternoon, etc.)
The first question has to be: What is the point of this? Do you really want to (only) write the results into the console in a real application?

Other than that, it is a bit pointless to pre-calculate the conditions in variables in this case, because they are only used once and they are exclusive to each other.