It create in name spaces object and I can use it.
Test = {};
Test.Car = function init(color){
this.color = color;
}
Test.Car.prototype.paint = function(color) {
return this.color = color;
};
Test.Car.prototype.print = function(){
return this.color;
}
Example of use:
var Car4 = new Test.Car('Blue');
Car4.paint('red');
alert(Car4.print());
Now I want to create new object and I want to inheritance form test:
Test2 = {} to do here to inheritance form Test and override using prototype ? Test2.prototype = Object.create(Test.prototype); not working
How can I do it. Need some help in that.
Testisn't a namespace, it's just an object.Object.create(Test.prototype)doesn't work becauseTestisn't a function. What is it you want to "inherit" fromTest?