I have this person object
function person(first, last, age, eye) {
this.firstName = first;
this.lastName = last;
this.age = age;
this.eyeColor = eye;
function sayName(){
var full="";
full="Hello my name is "+this.firstName + " "+this.lastName;
}
}
and have made an instance of this object
var raul = new person("Raul","Zamora","19","brown")
I cannot figure out why the function sayName is not working. I am implementing it as such:
document.getElementById("sayName").innerHTML=raul.sayName();
where sayName
is already defined as an id on the HTML part.