function ID(name, sport, APs) {
    this.name = name;
    this.sport = sport;
    this.APs = APs;
}

// define a setter for role in Person data
ID.prototype.setRole = function(role) {
    this.role = role;
}

// define a JSON conversion "method" associated with Person
ID.prototype.toJSON = function() {
    const obj = {name: this.name, sport: this.sport, APs: this.APs, role: this.role};
    const json = JSON.stringify(obj);
    return json;
}

function logItType(output){
    console.log(output);
}

// make a new Person and assign to variable teacher
var table1 = new ID("Alan", "swim", 4);  // object type is easy to work with in JavaScript
logItType(table1);  // before role
logItType(table1.toJSON());  // ok to do this even though role is not yet defined

// output of Object and JSON/string associated with Teacher
table1.setRole("Main User");   // set the role
logItType(table1); 
logItType(table1.toJSON());
ID { name: 'Alan', sport: 'swim', APs: 4 }
{"name":"Alan","sport":"swim","APs":4}
ID { name: 'Alan', sport: 'swim', APs: 4, role: 'Main User' }
{"name":"Alan","sport":"swim","APs":4,"role":"Main User"}
var tableGroup = [
    new ID("Ederick", "swim", "unknown"),
    new ID("Noor", "MMA", "unknown"),
    new ID("Steven", "unknown", "unknown")
]

logItType(tableGroup);
logItType(table1)
[ ID { name: 'Ederick', sport: 'swim', APs: 'unknown' },
  ID { name: 'Noor', sport: 'MMA', APs: 'unknown' },
  ID { name: 'Steven', sport: 'unknown', APs: 'unknown' } ]
ID { name: 'Alan', sport: 'swim', APs: 4, role: 'Main User' }