Created
February 5, 2021 15:43
-
-
Save anandaanv/32fa422526ab6556e7a723a95dfcf05a to your computer and use it in GitHub Desktop.
Can you write test for this code?
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(currentTime) { | |
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