Created
September 20, 2018 20:24
-
-
Save praveen-me/3bb7b84874f00acfe51da51b6c70a814 to your computer and use it in GitHub Desktop.
Chrome Extension Blog
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 for set Greet | |
function setGreet() { | |
let userName = localStorage.getItem('userNameKey'); | |
let now = new Date(); | |
let hours = now.getHours(); | |
//set greet msg according to hours | |
if(hours >= 4 && hours <= 12) { | |
greet_msg.innerHTML = 'Good Morning'; | |
} else if(hours >= 13 && hours <= 16) { | |
greet_msg.innerHTML = 'Good AfterNoon'; | |
} else if(hours >= 17 && hours <= 20) { | |
greet_msg.innerHTML = 'Good Evening'; | |
} else if(hours >= 21 && hours <= 23){ | |
greet_msg.innerHTML = 'Good Night'; | |
} else if(hours >= 0 && hours <= 3) { | |
greet_msg.innerHTML = 'Good Night'; | |
} | |
userNameElm.innerHTML = userName; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment