Am new in javascript OOP, please bear with me
Changing the value of parent object from inherited object Student should change the age of the person but am getting exactly same value.
<script>
function Person(age){
this.age=age;
}
function Student(){}
var person=Student.prototype=new Person(10);
var oldAge=person.age;
Student.age=20;
var newAge=person.age;
alert("Person old age="+oldAge+"\New age="+newAge);
</script>
as person
and Student
inherited from same Person
object then value of age of both sudent and person should change on changing the value from Student
I already went through Prototypical inheritance - writing up and JavaScript Inherited Properties Default Value questions
problem is i want to change the value of Person through Student which inherits the property of Person.
I think am missing something here please help me understand this.