var householdData = [];
function createMember(age, relationship, smoker) {
this.age = age;
this.relationship = relationship;
this.smoker = smoker;
}
addBtn.addEventListener("click", addHouseholdMember);
function addHouseholdMember() {
var selectedAge = "EaxampleData";
var selectedRelationship = "ExampleData";
var selectedText = "ExampleData";
var selectedSmoker = "ExampleData";
var currentMember = new createMember(selectedAge, selectedText, selectedSmoker);
console.log(currentMember);
return householdData.push(currentMember);
};
I am attempting to add the object I've created to an array. Although I can log the object when the button is clicked, I'm unable to return anything out of the click function. I realize I must be missing something simple, but I haven't been able to figure out what it is.