JavaScript Difference between Object.key and Object.prototype.key

Download JavaScript for free


Unlike in languages like Python, static properties of the constructor function are not inherited to instances. Instances only inherit from their prototype, which inherits from the parent type's prototype. Static properties are never inherited.

function Foo() {}; = 'bold';

var foo = new Foo();

console.log(; // 'bold'
console.log(; // undefined = 'italic';

console.log(; // 'bold'
console.log(; // 'italic'
New object from prototype