Guest OrientalSieg Posted February 5, 2008 Report Share Posted February 5, 2008 Dear all,How can I keep a varible valid from one run of a javascript function to the next run of the same function?Is it possible to store a variable somewhere and to retrieve it in the next run?Regards Link to comment Share on other sites More sharing options...
Ingolme Posted February 5, 2008 Report Share Posted February 5, 2008 You can store it in a global variable.For example: var G; // Declare the global variable outside of the functionsfunction doSomething(incomeValue) { if(!G) { G = incomeValue; } else { G++ } alert(G);} 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