(Maybe) I just solved a my problem (How to update front-end content after that a form is successfully submitted from a dialog window?) by \"storing\" / \"saving\" a variable
Another pattern to make a unique namespace in your application.
function myApp()
{
var value = 5;
function addToValue(x)
{
value += x;
}
}()
If you want functions/values to be accessible afterwards you can store them in an object like this:
function myApp()
{
this.value = 5;
this.addToValue = function(x)
{
this.value += x;
}
}
var myInstance = new myApp();