jQuery, AngularJS and JavaScript

JavaScript OOP and Prototype-based OOP

June 10th, 2016 / placed in Study. / Tags: , , , , .

JavaScript OOP

JavaScript OOP is about using self-contained chunks of code to develop applications. OOP is short for Object-Oriented Programming. These self-contained chunks of code are called objects. Building applications with objects as our building blocks in JavaScript has more potential when we use great advantages like Inheritance and Encapsulation.

Prototype-based OOP JavaScript

In prototype-based object-oriented programming we create an object. This object can have certain properties and functions. If we create an vehicle, this vehicle can have properties like vehicle.type and vehicle.color to create a simple basic vehicle. You can use this basic vehicle as a prototype for an more specific vehicle, all you need to do is to ‘clone’ that basic vehicle and add some other specific properties to it and you’ll have a custom vehicle! For example:

Lees verder