I'm learning javscript and trying to know more about object oriented programming.
i have a class called man
:
var man = function() {
this.name = "jack";
this.walk = function(){
console.log("im walking");
};
};
i want create another class called hero
that inherits from man
containing all man
class methods and properties
var hero = function(){
// inherit from man and has it own methods
};
How to do that so i can create object contain methods from both of them.