Javascript inheritance/prototype confusion -
this question has answer here:
i have question regarding inheritance/prototype in javascript, if there's 1 constructor contains 1 method "greeting", there's "greeting" method attached prototype of constructor, implementation use if 1 object created using constructor , calling method? method getting "overriden" or "shadowed"?
short answer: yes, being overridden.
from mdn:
javascript objects dynamic "bags" of properties (referred own properties). javascript objects have link prototype object. when trying access property of object, property not sought on object on prototype of object, prototype of prototype, , on until either property matching name found or end of prototype chain reached.
Comments
Post a Comment