Skip to content

Instantly share code, notes, and snippets.

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