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.

read on js inheritance , prototype chain.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -