I have a question about JavaScript. I'm currently using code similar to the code below:
function Game() {
}
I want to nest objects, so I can access them like so:
var a = new Game();
a.nested_object.method();
a.nested_object.property;
How would I go about doing this? Would I use a function or {}? Or does it even matter? The code below is an example code of what I am referring to.
function Game() {
this.id;
var stats = {};
}
Like I've stated above, can I access stats like so:
var a = new Game();
a.stats