In C++, the language I\'m most comfortable with, usually one declares an object like this:
class foo
{
public:
int bar;
int getBar() { return bar; }
this is like a public access modifier of objects(variables or functions), while var is the private access modifier
Example
var x = {};
x.hello = function(){
var k = 'Hello World';
this.m = 'Hello JavaScript';
}
var t = new x.hello();
console.log(t.k); //undefined
console.log(t.m); //Hello JavaScript