This is my first time to make an object in JS.
Can someone help me understand why the sourve did not work?
this is the full source:
<script>
function person(firstname,lastname,age,eyecolor) {
this.firstname=firstname;
this.lastname=lastname;
this.age=age;
this.eyecolor=eyecolor;
function getName() {
return this.firstname;
}
}
var myFather = new person("John","Doe",50,"blue");
document.write( myFather.getName() );
</script>