my question is probably identical and have same motive as this here i ain't using jQuery. I would like a javascript solution.
my object looks like below:
function Person(name, age, weight) {
this._name = name;
this._weight = weight;
this._age = age;
this.Anatomy = {
Weight: this._weight,
Height: function () {
//calculate height from age and weight
return this._age * this._weight;
//yeah this is stupid calculation but just a demonstration
//not to be intended and here this return the Anatomy object
//but i was expecting Person Object. Could someone correct the
//code. btw i don't like creating instance and referencing it
//globally like in the linked post
}
}
}