Javascript Object-Oriented Programming

Javascript object-oriented programming refers to a type of computer programming in which programmers define not only the data type of the data structure but also the types of operations(functions) that can be applied to the data structure.

Prototypical Inheritance

Essentially when you create an object along with the properties you give the object it also creates a new object within it automatically. This new object within every object is called proto. The two underscores are to make sure that you do not try to change it accidentally. This new proto object has access to multiple methods. Without having to type in the object and property to get to the prototype function you can just type “this” which allows it to reach the prototype method because it knows it is attached to the original object.

Function Constructors

The reason function constructors are powerful is the ability to add properties and methods to an object without having to repeat code. Here is the documentation of how to add properties and methods to objects.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Up ↑

%d bloggers like this: