Object Constructor Functions
Sometimes we need to create many objects of the same type.
To create an object type we use an object constructor function.
It is considered good practice to name constructor functions
function person(Name,age,Rollno) {
this.firstname=Name;
this.age=age;
this.rollno=Rollno;
}
const Studentabi=new person("abisheck",21,22674);
const Studentajay=new person("ajay",21,22675);
const Studentkiran=new person("kiran",21,22676);
console.log(Studentabi);
console.log(Studentajay);
console.log(Studentkiran);
Top comments (0)