Message from JavaScript discussions

May 2018

— Well, it's simplier, single base object, one level of inheritance

— 

In classical inheritance ( used in Java for example ), when x class inherits y class it creates a copy of the property and methods (functions). So if you change property from x object , it wont reflect in y object. So basically it is creating new copy everytime.

While in prototype inheritance (for example javascript), when x object is linked(inherit?) to another y object it doent create copy but use the same property and methods. Here if you change the value of property from x object , it will reflect in y object as well. So basically both use common property not copy of it.

— Wat

— "prototype inheritance" i dont get

— If you clone/prototype the object obj = ^^base, and then do obj.property = 10, the base.property is not changed

Message permanent page

— Go to livescript.net and test this:

base = {property: 1}
obj = ^^base
obj.property = 10
base.property

Message permanent page

— If you press "Run" button, it will show the "1"

— Sorry my bad. It actually creates another property of same name which is called shadowing

— Below is the exampk

— Var anotherObject = { a: 2 }; var myObject = Object.create( anotherObject ); anotherObject.a; // 2 myObject.a; // 2 anotherObject.hasOwnProperty( "a" ); // true myObject.hasOwnProperty( "a" ); // false myObject.a++; // oops, implicit shadowing! anotherObject.a; // 2 myObject.a; // 3 myObject.hasOwnProperty( "a" ); // true

Message permanent page

— You copied it from the closed Issue in "You dont know JS". It's closed, because somebody argued that "implicit" is not implicit... imo, i dont see any "implicit" things there, everything is determined

Message permanent page

— Hello guys! Can someone tell me how I can store image url which should be seen from my frontend into my database. I'm using postgres and sequelise ORM.

Message permanent page