diff --git a/javascript.md b/javascript.md index b21ce91..db9d55a 100644 --- a/javascript.md +++ b/javascript.md @@ -342,3 +342,19 @@ var Person = function(){ Person.genders = ['male', 'female']; console.log(Person.genders); ``` + +We can have a "class" inherit from another class, using the `.call` static method of a function + +```javascript +var Car = function(){ + this.wheels = 4; +} + +var Humvee = function(){ + Car.call(this); + this.numAmericanFlags = 4; +} + +var murica = new Humvee(); +console.log(murica); +```