JavaScript Tutorial ✦
Constructor Function
Function designed to initialize new objects using the new keyword.
function Person(name) {
this.name = name;
}
Person.prototype.greet = function() {
console.log(`Hello, ${this.name}`);
};
const john = new Person('John');