Prototype in JavaScript

kudvenkat
Youtube
Related Topic
:- Web Development Javascript

In this video we will discuss Prototype object in JavaScript. Let us understand it's use with an example. The following Employee constructor function constructs Employee object. function Employee(name) { this.name = name; } There are several ways to add a function to the Employee object. One way is as shown below. This works but the problem with this approach is that, if you create 100 employee objects there will be 100 copies of getName() function. 

Comments