As an exercise, I'm writing my code within the same namespace (namespace being sample):
if ("undefined" == typeof(sample)) {
var sample = {};
}
sample = {
foo : function () {
},
bar : function () {
}
};
How do I create a variable within the same namespace which is accessible by all functions?
See Question&Answers more detail:os