I'm new to JavaScript and I'm struggling to understand how
function Person(age, name, gender) {
    this.name = name;
    this.age = age;
    this.gender = gender;
}
is any different than
function Person(age, name, gender) {
    name = this.name;
    age = this.age;
    gender = this.gender;
}
Because with the first version of the code, everything runs smoothly and when I create
var Bob = new Person(30, "Bob", "male");
and do this
document.getElementById("demo").innerHTML = Bob.name;
it successfully prints "Bob". But when I run the second version of the code I get undefined. Why or how does it matter which side of the equal sign something is on?
 
     
     
     
    