Message from JavaScript discussions

September 2017

— Prototypes are not instantiated when you use new, meaning it is a static object


If you assign functions to the class directly with this, then you are copying multiple functions every time you use new

— Also, assignments done to props on an instance of an object do not overwrite the prototype

— They override the prototype's properties, but they remain untouched

— This also means you can chain prototypes between each other or share them between different classes, all without worrying about it being modified

Message permanent page

— IE, a prototype can have a prototype, and so forth, allowing you to "extend" objects

— That is how the JS basic "class" system works, it's not classes at all but rather chains of objects with properties that override each other from the top-down

Message permanent page

— If you are using ES2015 classes this looks a lot different when you write it out though, as it's some sugar to make it look like normal classes

Message permanent page

— You're insane

— Mad scientist stuff

— Performance reasons, copying functions (directly on the object) vs referencing functions (using prototypes)

Message permanent page

— Welp my iterator has an identity crisis now... with FIFO queue it is BFS and not IDDFS... and if I switch to a stack it's DFS and breaks filter and path mapping

Message permanent page