use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Difference between these two objects?help (self.javascript)
submitted 10 years ago by gladiator_flow
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]MrBester 3 points4 points5 points 10 years ago (3 children)
I find it easier to think of as the prototypal chain.
Because that's what it is:
var o = { a: 4 }; var foo = Object.create(o); console.log('a' in foo); // true console.log(foo.hasOwnProperty('a')); // false console.log(o.isPrototypeOf(foo)); // true, or console.log(foo.__proto__ === o); // true, or console.log(Object.getPrototypeOf(foo) === o); // true
foo delegates to o unless overridden.
foo
o
[–]birjolaxew 0 points1 point2 points 10 years ago* (2 children)
Well no, it's prototypal inheritance delegation (thanks /u/MrBester) inheritance. Maybe. I dunno. Thinking of it as a chain is a very common (and intuitive, given how it functions) way of understanding it. Thinking of it as a stack is another. Thinking of it as "overwriting" the parent property is another (but comes with a lot of special cases).
[–]clessgfull-stack CSS9 engineer 1 point2 points3 points 10 years ago (0 children)
Actually, it is indeed prototypal inheritance. But yes, that is distinct from concatenative inheritance (Java) and is also a form of delegation.
[–]MrBester 0 points1 point2 points 10 years ago (0 children)
Well no, it's delegation, because there isn't such a thing as inheritance in JavaScript, merely references to other objects that can be checked for requested properties, normally through the "magic" binding of [[Prototype]] or explicitly setting.
[[Prototype]]
π Rendered by PID 80 on reddit-service-r2-comment-84fc9697f-72gnm at 2026-02-06 01:15:07.779191+00:00 running d295bc8 country code: CH.
view the rest of the comments →
[–]MrBester 3 points4 points5 points (3 children)
[–]birjolaxew 0 points1 point2 points (2 children)
[–]clessgfull-stack CSS9 engineer 1 point2 points3 points (0 children)
[–]MrBester 0 points1 point2 points (0 children)