Last active
February 7, 2021 02:37
-
-
Save Fernando74lr/5a6350e5d802a1ebebba16a1274b4332 to your computer and use it in GitHub Desktop.
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
// Gretting by the moment of the day | |
function getDayMoment() { | |
let hour = new Date().getHours(); | |
if (hour < 12) return ['Good morning', '👋']; | |
if (hour >= 12 && hour < 18) return ['Good afternoon', '👋']; | |
if (hour >= 18 && hour < 20) return ['Good evening', '🌗']; | |
if (hour >= 20) return ['Good night', '🌙']; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Small script to greet depending on the time of day with JS