I am trying to get a function that prompts a user for info and then passes that info to an object. So far it does not seem to be doing that.
// my object constructor
var Person = function (firstName, lastName, areaCode, phone) {
this.firstName = firstName;
this.lastName = lastName;
this.areaCode = areaCode;
this.phone = phone;
}
// my function to get user info
function getInfo() {
firstName = prompt("What is your first name: ");
lastName = prompt("What is your last name: ");
areaCode = prompt("What is your area code: ");
phone = prompt("What is your phone number: ");
var guy = Person(firstName, lastName, areaCode, phone);
return guy;
}
// calling the function
getInfo();
// test to see if it actually worked
document.writeln(guy.firstName);