I created a function called Person, defined below:
function Person(name, age) {
this.name = name
this.age = age
}
I then used function as an object function constructor, and created a birthday function in the prototype. What I am confused about is why does the last two lines in the code snippet below print different things to the console?
John = new Person("John", 30)
Person.prototype.birthday = function() {
this.age++
}
Person.prototype //prints { birthday: [Function (anonymous)] }
Person.__proto__ //prints {}