We help IT Professionals succeed at work.

Javascript reset all variables

oggiemc
oggiemc used Ask the Experts™
on
Hello all,

I  have an outer function which contains two inner functions..After a condition is met in one of the inner functions, i want to reset all the variables in each function including the outer one..Is there a quick way to do this?? Could i deallocate the memory or something?

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Can you post an example of your code?

You can do something like this:

   for ( var item in this ) {
      if ( typeof( this[item] ) == "string" ) {
        this[item] = "";
      }
    }

Wow... Thanks for the love on that.  I don't feel I deserved it.