Question: What is the MAIN reason for creating object methods ( functions ) using the 'prototype' keyword instead of embedding the teacherFullName method in the object

What is the MAIN reason for creating object methods (functions) using the 'prototype' keyword instead of embedding the teacherFullName method in the object definition itself?
function Course(name, teacherFirst, teacherLast){
this.name=name;
this.teacherFirst=teacherFirst;
this.teacherLast=teacherLast;
this.students=[];
//let's move this class to a prototype
//this.teacherFullName(){
//return `${teacherFirst} ${teacherLast};
//}
}
Course.prototype.teacherFullName(){
return `${teacherFirst} ${teacherLast};
}
Group of answer choices
Code is easier to read
It's required
To keep it from being duplicated with each object instance
We don't want to share it with other class instances

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!