Prototype is all JavaScript objects inherit properties and methods to the class.
Example code :
var Person =function (name,age){
this.name = name;
this.age = age;
}
var objPerson1= new Person("Bikash",30);
var objPerson2= new Person("Bikash1",40);
//inherit properties using prototype
Person.prototype.color="fair";
//inherit method using prototype
Person.prototype.getDetails=function(){
return 'Name : '+this.name +' Age : '+this.age;
}
document.write(objPerson1.getDetails());
console.log(objPerson2.getDetails());
Please subscribe my channel and raise your question in the comment section.
On this page of the site you can watch the video online What is Basic JavaScript Object Prototype with a duration of hours minute second in good quality, which was uploaded by the user Brnfullstack 05 September 2020, share the link with friends and acquaintances, this video has already been watched 23 times on youtube and it was liked by 1 viewers. Enjoy your viewing!