Alright so this one is a lot, and I apologize in advance because I just looked at this today so it might very rough. So I am asking the user for their name, age, and gender. This is put into the Person object, and in it I have my method which is suppose to calculate life expectancy. I then have the myPerson variable of the Person object, which is suppose to take what the user entered and displayed it. Again I just looked at this not to long ago, and gave it my best shot.
Also I have never really understood what this. does, I just used it because thats the way the book has it set up. So if someone can explain that to me I would appreciate it.
So I have made changes to the code, but still need help with the output. My new person is suppose to take ehat the user entered, and display that. For my last line I give them how long they have left or can expect, so do I have to pass those variables to my new person? Or shouldn't I be able to just to use them? Or does the "this." come into play when trying to get the values of the varaibles? Again im not entirely sure what the .this does I just followed the book
After looking at more samples, and looking closer at the book im certain my output should look like below, but nothing prints out? The myPerson has all the properties of the Person object so there would be no need to try, and pass them. I tried just doing document.write(myPerson.fullName); to see if it prints out, but nothing. So my fullName is not getting a value?