Guest OrientalSieg Posted February 5, 2008 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 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
Archived
This topic is now archived and is closed to further replies.