How do I clear Javascript resources?

When I'm developing JavaScript code, I try to make use of everything I can to monitor variables, troubleshoot errors, and perform test-use cases. Currently, when I use alert messages or post variables to JavaScript objects, they somehow get saved in the background and can't be cleared in the current session. The result: I run the program once, get an alert message and data. Tweak the program a little, re-run, now I get 2 alert messages and the data may or may not override. If I re-run, I get 3 alert messages... if keeps going.

It's at the point where if I have to develop JavaScript code in a dashboard, I have to completely close and re-open the session to make sure I clear the background resources. This is very time consuming.

My impact:

Currently affects 2 dashboards

Potential to affect  a total of 10 dashboards within the next 6 months