Bebo Khouja Posted August 24, 2021 Share Posted August 24, 2021 I try those code but it does not change the value. I try those code but still don't change the value of the variable Here are codes i try isDebug = true; // This code was already inserted to the website And another one: let isDebug = true; But however these don't change the value Link to comment Share on other sites More sharing options...
Ingolme Posted August 24, 2021 Share Posted August 24, 2021 The variable isDebug will have the value you gave it. You can verify by adding the following line of code right below: alert(isDebug); Your problem is probably caused by something else. It might be that the variable is in a different scope. Link to comment Share on other sites More sharing options...
Bebo Khouja Posted August 25, 2021 Author Share Posted August 25, 2021 The value change but however the value resets after going to the main page. The code contains var isDebug = false; Link to comment Share on other sites More sharing options...
Ingolme Posted August 25, 2021 Share Posted August 25, 2021 Javascript variables do not carry on from one page to another. Javascript begins running when the page loads and ends when you leave or reload the page, all variables are lost after that. If you want to send data between pages or keep it when the page reloads you can use the Storage API. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now