Created
September 17, 2017 19:24
-
-
Save Arieg419/3502be7c607d844645d8c69ab688ad23 to your computer and use it in GitHub Desktop.
A method that checks for a cookie with a key of "username".
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
const getUserData = () => { | |
let username = fetchCookie(); | |
if (username != "") { | |
alert("Welcome again " + username); | |
} else { | |
username = prompt("Please enter your name:",""); | |
setCookie("username", username, 30); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment