I am sure their a several reference and great answers explaining prototype in Javascript,
My question happens to be simple, When I create something like this.
function Person(first, last, age, eye) {
this.firstName = first;
this.lastName = last;
this.age = age;
this.eyeColor = eye;
}
Person.prototype.nationality = "English";
var myFather = new Person("John", "Doe", 50, "blue");
var myMother = new Person("Sally", "Rally", 48, "green");
And console.log myFather it displays its firstName, LastName, age, eyeColor but no the nationality but when I do something like this..
myFather.nationality
it displays nationality to be "english"
Now, I am running everything in chrome console log and my question is why does nationality does not appear by default in console.log
of myFather
object