example:
function Person(first,last,age){
this.first=first;
this.last=last;
this.age=age;
} //constructor
var john = new Person(John,Smith,55);
Now my question is, how do i add eyecolor property for john only?
example:
function Person(first,last,age){
this.first=first;
this.last=last;
this.age=age;
} //constructor
var john = new Person(John,Smith,55);
Now my question is, how do i add eyecolor property for john only?
you can do this by using following code;
function Person(first,last,age){
this.first=first;
this.last=last;
this.age=age;
} //constructor
var john = new Person('John','Smith',55);
john.eyecolor="blue";
console.log(john);