Conversation
Notices
-
This may be a retarded question since I don't know anything about JavaScript and I've just been trying to hack code together from what I've read on stackoverflow.
If I write an if/else function that is executed by page onload, and the function does localStorage.setItem if one thing and again if else, and uses the same key for both localStorage.setItem lines, is that key overwritten when the else is called if the 'if' has been called before? I may be retarded.
-
@Zealous >when the else is called if the 'if' has been called before
That's the point of an else. There'd have to be two invocations of the function (so, two page loads). And yes, it would overwrite it because it's the same key.
Unless localstorage is retarded, which being browser-related, it probably is.
-
@Zerglingman based thank you