Why use Object.prototype.hasOwnProperty.call(myObj, prop) instead of myObj.hasOwnProperty(prop)?

Is there any practical difference [between my examples]? The user may have a JavaScript object created with Object.create(null), which will have a null [[Prototype]] chain, and therefore won’t have hasOwnProperty() available on it. Using your second form would fail to work for this reason. It’s also a safer reference to Object.prototype.hasOwnProperty() (and also shorter). You … Read more

What are the nuances of scope prototypal / prototypical inheritance in AngularJS?

Quick answer: A child scope normally prototypically inherits from its parent scope, but not always. One exception to this rule is a directive with scope: { … } — this creates an “isolate” scope that does not prototypically inherit. This construct is often used when creating a “reusable component” directive. As for the nuances, scope … Read more