I created an object like the following.
var BaseObject = function(){
var base = this;
base.prop;
base.setProp = function(val){
base.prop = val;
}
}
There is only one BaseObject instance from which all TestObjects inherit. Don't use instances for creating prototype chains!
What you want is:
var TestObject = function(){
BaseObject.call(this); // give this instance own properties from BaseObject
// do something
}
TestObject.prototype = Object.create(BaseObject.prototype);
See JavaScript inheritance: Object.create vs new, Correct javascript inheritance and What is the reason to use the 'new' keyword at Derived.prototype = new Base for a detailed explanation of the problems with new. Also have a look at Crockford's Prototypal inheritance - Issues with nested objects