Hello,
I tried to display text on the screen base on the time.
example :
if current time is 12:30 output should be "good after-non Jonh" but in my code something wrong i.e. after 12 pm output default expression . i am not able to find the problem please help me .
let today = new Date();
let hours = today.getHours();
let mins = today.getMinutes();
let seconds = today.getSeconds();
let totalSeconds = hours * 60 * 60 + mins * 60 + seconds;
let msg = "";
let flag;
switch (flag) {
case totalSeconds >= 0 && totalSeconds <= 43199:
msg = "Good morning " + value;
break;
case totalSeconds >= 43200 && totalSeconds <= 53999:
msg = "Good Afternon " + value;
break;
default:
msg = "good evening " + value;
break;
}
return msg;