I'm trying to understand JavaScript prototype and when I attempted coding this I get an error:
function Person(firstname, last name) {
this.firstname = firstname;
this.lastname = lastname;
}
var A = new Person('John', 'Doe');
A.prototype.name = 'Toby';
I get an error stating cannot set property 'name' of undefined. Can't i assign a property on it's prototype of Object A. This is just a simple exercise to get an understanding of prototypes