Skip to main content

Command Palette

Search for a command to run...

OLOO in JavaScript

Published
•1 min read•View as Markdown

OLOO means Object Linked to Other Object. We are linking one object of Javascript to another object to access the properties defined in the parent object. By using Object linking, we can easily achieve the inheritance of Class-based object orientation.

At first, we need to link one object to another object. In JS, there is default property for objects is "__proto__" which will point to another object. So if we create an object by using "Object.create(other_object_name)", the __proto__ of the newly created object will point towards the object which is passed as an argument while creating.

We have linked one object to another object. Now we can directly access the properties and methods of the parent object without using the parent object name. Also, we can link multiple objects to a single parent object. If we add a new property or modify the existing property of the parent object after the linked objects are created, the changes will be reflected in the linked objects too.

Parent components also have a default method of "init" which will be used to set the initial values when creating a new object.