Explain JavaScript’s prototype inheritance.

JavaScript uses prototypes to allow objects to inherit properties from other objects.

function Person(name) {
  this.name = name;
}
Person.prototype.greet = function() {
  console.log(`Hello, ${this.name}`);
};
const alice = new Person("Alice");
alice.greet(); // "Hello, Alice"