Jump to content

JavaScript "isDebug" variable is not changing the value


Bebo Khouja

Recommended Posts

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...