3 ms·
"best practices": "use class instead of manipulating prototype directly" Who comes up with these "rules"? This is not a hard and fast rule. Manipulating the pr
by iamleppert 10y ago
"best practices": "use class instead of manipulating prototype directly"
Who comes up with these "rules"? This is not a hard and fast rule. Manipulating the prototype of an object is not "dangerous".
I'm sick and tired of some loud mouth saying something is dangerous without explaining why. WHY? Why it it dangerous? Don't talk at me. Provide me a sound reason and case to justify what you say. Talk is cheap.
It makes me not trust anything else in this article when someone is flippant.
- CGamesPlay 10y agohttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... This has some warnings at the top as to why.
- hajile 10y ago__proto__ !== prototype One points to the parent of an object and the other points to the object's prototype (which in turn has it's own `__proto__ property). Accessing `prototype` is just fine, but if you want to access `__proto__` then you should use `Object.create()` instead.