I am reading a JavaScript book and here the constructor function is created like this:
var Person = function (living, age, gender) {
this.living = living;
this.age = age;
this.gender = gender;
this.getGender = function () { return this.gender; };
};
And I read somewhere something like this:
function Person (living, age, gender) {
this.living = living;
this.age = age;
this.gender = gender;
this.getGender = function () { return this.gender; };
};
I wonder what the difference is between these two. Is there any difference when we create instances or are they the same, just two different ways of creating object constructors?