r/javascript • u/magenta_placenta • Nov 16 '17
JavaScript. The Core: 2nd Edition
http://dmitrysoshnikov.com/ecmascript/javascript-the-core-2nd-edition/16
Nov 16 '17
[removed] — view removed comment
9
u/andion82 Nov 16 '17
He does state this on a note:
Note: even though the proto property is standardized today, and is easier to use for explanations, on practice prefer using API methods for prototype manipulations, such as Object.create, Object.getPrototypeOf, Object.setPrototypeOf, and similar on the Reflect module.
0
Nov 16 '17
[deleted]
5
5
u/kenman Nov 17 '17
Hey, thanks for your contributions to our FAQ!
(this was the only way I could guild you with creddits)
4
Nov 17 '17
[removed] — view removed comment
1
u/coffeeandlearning Nov 17 '17
There is a prototype property on all function objects which is different from the internal proto property that all objects have, so I think it's the best way to be honest.
1
Nov 17 '17
[removed] — view removed comment
1
u/coffeeandlearning Nov 17 '17
I'm not quite sure what you mean by "extend prototype from the constructor function". Maybe I'm just missing the context.
I was just saying he uses the two terms for the sake of clarity. You never use proto in real code because if you do it slows everything down because the interpreter can no longer make certain assumptions about our code and a lot of optimizations go out the window.
10
u/coffeeandlearning Nov 16 '17
I LOVED his original set of posts and I can't wait to check this out and I'm so excited it's getting more exposure. His was the first that made me really understand prototypes. My most upvoted post is just a table of contents of his original work before he redesigned his site.
Highly recommend this to anyone to read. It's in my top 3 resources along with Crockford's lectures and YDKJS.