Skip to content

Instantly share code, notes, and snippets.

@Arieg419
Created September 17, 2017 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arieg419/3502be7c607d844645d8c69ab688ad23 to your computer and use it in GitHub Desktop.
Save Arieg419/3502be7c607d844645d8c69ab688ad23 to your computer and use it in GitHub Desktop.
A method that checks for a cookie with a key of "username".
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