Created
December 1, 2015 20:03
-
-
Save Saucy/ec844e787093743c1e70 to your computer and use it in GitHub Desktop.
Poor JavaScript example of LocalStorage
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
var CanDownload = localStorage.getItem('CanDownload'); | |
// If localStorage variable 'CanDownload' isn't set yet, set it to true | |
if (CanDownload == null) { | |
localStorage.setItem('CanDownload', true); | |
} | |
// function called when button is clicked | |
// changes CanDownload status to false | |
function ChangeButton () { | |
localStorage.setItem('CanDownload', false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment