02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoPrevious Video

Inheritance

<p>In the last section of this training we adding dynamically methods to the built in objects. In this next section we will extend the functionalities of the built in objects by creating a new sub object. This object would then be linked to the original object. We continue from where we last left off and add into the mix the capability to extend the class using inheritance. In javascript its not exactly inheritance as you would see in a standard oop language such as Java/ActionScript3 in JavaScript there is a chain and as such we can disconnect or reconnect chains. In our case we will create a totally new object and then link it to an existing Object type. In our case we will create an advanced Array called ArrayExt that extends the functionalities of the Array.</p> <p>We will add a few new methods to our new array. And text it out. We broach the topic of encapsulation. Encapsulation in its essence is the idea of what variables are visible if we loop through an object while what variables are hidden. The default behavior of an Array is all the new methods/properties are enumerable while built in methods/properties are not. Don't worry to much about the strict definition of encapsulation all you want to know is a variable loop-able or not. If that sounds a bit unclear it means its time to jump into our video so we can expand on this topic.</p>

Call and Apply

Functions are objects. There probably the most primitive type in JavaScript. To show case this we will create an example working with scope.

08:55

Creating And Working with Methods

A method is a function that is owned by an object. We will create our method and now it is available to all instances of the object type we added this prototype.

08:51

Creating and Working with Properties

Functions are objects. There probably the most primitive type in JavaScript. To show case this we will create an example working with scope.

02:33

Adding methods to built in Objects

How do JavaScript prototypes work? Lets see them in action by showing you how you can add prototype methods by adding new methods to built in objects such as the Array object.

04:32

Inheritance

Extending the Built in JavaScript Objects using inheritance and the prototype.

12:43