function Person(name) { this.name = name; }
Person.prototype.greet = function() { return 'Hi, ' + this.name; };
new Person('Alice').greet(); // 'Hi, Alice'Add methods to a constructor prototype to share them across all instances.
The hasOwnProperty() method determines if an object has a property as its own, not inherited from the prototype chain. This is crucial for filtering inherited properties.
Challenge: Use hasOwnProperty() to check if a property belongs to an object itself versus its prototype.