I have a variable in a web page that gets set to a value and is of type string. When a button is clicked, it calls a function & at the end of the function, I would want to clean up anything that had been set previously. I have tried using:
$.removeData(myVar);
but it doesn't do anything. Log statements before & after that statement show that it still has the value & type both before & after the above statement.
Another unused variable has a value of undefined
and a type of undefined
. Both these variables happen to be global variables in the page.
How do you reset myVar
to its initial state? I know it ought to be simple, but I'm missing something. Would appreciate any help.