Using Prototype Objects
This lesson teaches how to add properties and methods to an object prototype.
Adding Properties
We already discussed why properties could be added to the prototype object of a constructor function. Now let’ look at the method to do so.
Syntax
Here is how properties can be added to a constructor function using the prototype property:
Press + to interact
ConstructorFunctionName.prototype.PropertyName = PropertyValue
Since the property is being defined on the prototype of the ...
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy