I\'ve got a JavaScript \"object\", built this way:
function foo()
{
this.length = 0;
}
foo.prototype.getLength = function()
{
return this.length;
}
...
Both answers were very helpful! Here's what I ended up with:
if( typeof( rpNameSpace ) == "undefined" ) rpNameSpace = {};
rpNameSpace.foo = function() {
this.length = 613;
}
rpNameSpace.foo.prototype.getLength = function() {
return this.length * 2;
}
Then, to use the resulting "namespaced" object:
var x = new rpNameSpace.foo()
display( x.getLength() );