Object-Orienting

In notebook:
FrontEndMasters Advanced JavaScript
Created at:
2016-10-05
Updated:
2016-10-05
Tags:
Fundamentals JavaScript
Kyle has a different take on objects than "most of javascript community". First of all, no classes in JavaScript.

Prototype

every single "object" is built by a constructor function (constructor call)

Most languages that called as "object-oriented" are in fact class-oriented. Only Lua and JavaScript are true object-oriented languages.
Only in these two language can you create an object without creating, instantiating a class.

each time a constructor is called,a new object is created.

> A constructor makes an object "based on" its own prototype

He challenges this statement. It's not _based on_ in JavaScript. It implies that we take a prototype and stamp out a copy of that. As if there was an "instance" of the object. It's not true for JavaScript. Instead:

> A constructor makes an object _linked to_ its own prototype