Last active
February 5, 2021 15:30
-
-
Save anandaanv/95fd2d2d1bb8a9fb5ccccbef2308abfa to your computer and use it in GitHub Desktop.
what time is it? untestable version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function whatTimeIsIt() { | |
var currentTime = new Date(); | |
var hr = currentTime.getHours(); | |
if(hr < 12) { | |
return "morning"; | |
} | |
if(hr < 16) { | |
return "afternoon"; | |
} | |
if(hr > 16) { | |
return "evening"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment