Complete the code to create a constructor function named Person.
function [1](name, age) {
this.name = name;
this.age = age;
}The constructor function must be named Person to match the usage convention.
Complete the code to create a new Person object named john.
const john = new [1]('John', 30);
new keyword.Use the Person constructor function with the new keyword to create an object.
Fix the error in the constructor function to correctly assign the age property.
function Person(name, age) {
this.name = name;
this.[1] = age;
}The property name must exactly match age to store the age value correctly.
Fill both blanks to add a method greet to the Person prototype that returns a greeting string.
Person.prototype.[1] = function() { return `Hello, my name is [2].`; };
this to access properties.The method name should be greet, and inside the method, use this.name to access the object's name.
Fill all three blanks to create a Person object and call its greet method, storing the result in message.
const [1] = new Person('Alice', 25); const [2] = [3].greet();
Create an object named alice, then call greet() on it and store the result in message.