console.log("Hello, World!");
console.log("testing out java console.log")
console.log("trial")
Hello, World!
testing out java console.log
trial
var msg = "Hello, World!";
console.log(msg);
Hello, World!
function logIt(output) {
    console.log(output);
}
logIt(msg);
Hello, World!
console.log("Reuse of logIT")
logIt("Hello, Mr Yeung Please Give Me a 3!");
logIt(100)
logIt("percent!")
Reuse of logIT
Hello, Mr Yeung Please Give Me a 3!
100
percent!
function logItType(output) {
    console.log(typeof output, ";", output);
}
console.log("Testing Out JavaScript Functions")
logItType(" A string"); 
logItType(2020);  
logItType([1, 2, 3]);
Testing Out JavaScript Functions
string ;  A string
number ; 2020
object ; [ 1, 2, 3 ]
function Person(player, team, region) {
    this.player = player;
    this.team = team;
    this.region = region;
    this.role = "";
}


Person.prototype.setRole = function(role) {
    this.role = role;
}


Person.prototype.toJSON = function() {
    const obj = {player: this.player, team: this.team, region: this.region, role: this.role};
    const json = JSON.stringify(obj);
    return json;
}

var Player = new Person("Krishiv", " Del Mar Sharks","USA" );
Player.setRole("Player");

logItType(Player); 
logItType(Player.toJSON());
object ; Person {
  player: 'Krishiv',
  team: ' Del Mar Sharks',
  region: 'USA',
  role: 'Player' }
string ; {"player":"Krishiv","team":" Del Mar Sharks","region":"USA","role":"Player"}
var gamers = [ 
    new Person("Messi", "PSG", "europe"),
    new Person("Ronaldo", "ManU", "europe"),
    new Person("vela", "LAFC", "USA"),
    new Person("mount", "CHELSEA FC", "europe"),

];

function Classroom(teacher, students){ 
    
    teacher.setRole("Teacher");
    this.teacher = teacher;
    this.classroom = [teacher];
 
    this.students = students;
    this.students.forEach(student => { student.setRole("Student"); this.classroom.push(student); });
    /
    this.json = [];
    this.classroom.forEach(person => this.json.push(person.toJSON()));
}


compsci = new Classroom(teacher, students);

logItType(compsci.classroom);  
logItType(compsci.classroom[0].name);  
logItType(compsci.json[0]);
object ; [ Person { name: 'Mr M', ghID: 'jm1021', classOf: 1977, role: 'Teacher' },
  Person {
    player: 'Messi',
    team: 'PSG',
    region: 'europe',
    role: 'Student' },
  Person {
    player: 'Ronaldo',
    team: 'ManU',
    region: 'europe',
    role: 'Student' },
  Person { player: 'vela', team: 'LAFC', region: 'USA', role: 'Student' },
  Person {
    player: 'mount',
    team: 'CHELSEA FC',
    region: 'europe',
    role: 'Student' } ]
string ; Mr M
string ; {"name":"Mr M","ghID":"jm1021","classOf":1977,"role":"Teacher"}
object ; { name: 'Mr M', ghID: 'jm1021', classOf: 1977, role: 'Teacher' }
Classroom.prototype._toHtml = function() {

  var style = (
    "display:inline-block;" +
    "background:green;" +
    "border: 2px solid grey;" +
    "box-shadow: 0.8em 0.4em 0.4em grey;"
  );


  var body = "";

  body += "<tr>";
  body += "<th><mark>" + "Player" + "</mark></th>";
  body += "<th><mark>" + "Team" + "</mark></th>";
  body += "<th><mark>" + "Region" + "</mark></th>";
  body += "</tr>";
  
  for (var row of compsci.classroom) {
   
    body += "<tr>";
   
    body += "<td>" + row.player + "</td>";
    body += "<td>" + row.team + "</td>";
    body += "<td>" + row.region + "</td>";
   
    body += "<tr>";
  }

   
  return (
    "<div style='" + style + "'>" +
      "<table>" +
        body +
      "</table>" +
    "</div>"
  );

};


$$.html(compsci._toHtml());
</table></div> </div> </div> </div> </div> </div> </div>
PlayerTeamRegion
undefinedundefinedundefined
MessiPSGeurope
RonaldoManUeurope
velaLAFCUSA
mountCHELSEA FCeurope