Created
July 12, 2017 05:51
-
-
Save jazzedge/20b9bf83536cfe20d31a692d99feaa09 to your computer and use it in GitHub Desktop.
Bot - Morning, Afternoon, Evening function
This file contains hidden or 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
| // This function returns a string indicating if it is morning, afternoon or evening. | |
| function amPm () { | |
| const date = new Date().getHours(); | |
| console.log ('Date:', date); | |
| var period = 'evening'; | |
| if (date < 12) { | |
| period = "morning"; | |
| } else { | |
| if (date < 18){ | |
| period = "afternoon"; | |
| } | |
| } | |
| return period; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment