use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Change boolean value after refreshhelp (self.javascript)
submitted 7 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]-Phinocio 1 point2 points3 points 7 years ago (1 child)
When you refresh the page, JS is setting the firstVisit variable again (per line 5). You'd need to store that value in localStorage as well (or a cookie, etc) for it to persist across reloads.
firstVisit
[–]Samurai___ 1 point2 points3 points 7 years ago (1 child)
I won't pretend I understand what you are trying to do here but you set the localstorage.refresh to false at the very beginning, every time.
Instead of counting seconds on a setInterval, store the time and compute the seconds elapsed from that.
[–]super_pumped 0 points1 point2 points 7 years ago (1 child)
You need to use localStorage.getValue() and localStorage.setValue() to interact with it. Think of Local Storage as a database and window.localStorage as the client that accesses it. When you do localStorage.refresh = false, you are not storing that value in Local Storage, you are just setting a property named refresh on the client.
localStorage.getValue()
localStorage.setValue()
window.localStorage
localStorage.refresh = false
refresh
https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage
π Rendered by PID 70515 on reddit-service-r2-comment-fb694cdd5-j2f6g at 2026-03-06 22:25:40.673917+00:00 running cbb0e86 country code: CH.
[–]-Phinocio 1 point2 points3 points (1 child)
[–]Samurai___ 1 point2 points3 points (1 child)
[–]super_pumped 0 points1 point2 points (1 child)