How to inherit one object from another while objects are created using object literals in javascript
- by rajakvk
I hope this will work
var Human = function() {
this.name = "baby";
this.age = 0;
}
var Man = function() {
this.sex = male;
}
Man.prototype = Human;
But
var Human = {
name:"baby",
age:0
};
var Man = {
sex:"male"
};
How to inherit one object from another while objects are created using object literals in javascript?