Message from JavaScript discussions
September 2017
—
nodeStack[nodeStack.length] = nextTuple;
state.paths[state.paths.length] = Array.from(state.paths[state.paths.length - nodeStack.length]);
state.paths[state.paths.length - 1].push(state.accessor);
So far it only does containers/objects... I want to add primitives as well somehow but it is slightly harder
— Bahahaha it grew mother fuckers!
— 🌚
— Hey guys, i dont understand why to use prototype instead to make methods and fields in the object class
— 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
— 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