Hello Everyone,
I am working on a creating an instance of a class in JavaScript using Object-Oriented skills. The question I have is how can I implement an object graph with using the code that I have so far in my JavaScript file? Here is my code so far.
I am working on a creating an instance of a class in JavaScript using Object-Oriented skills. The question I have is how can I implement an object graph with using the code that I have so far in my JavaScript file? Here is my code so far.
Code:
function Person(Name, Grade, Gender, GPA, ClassRank)
{
this.Name= name;
**** this.Grade = grade;
**** this.Gender = gender;
**** this.GPA = gpa;
*** this.ClassRank = classRank;
}
var student1= new Person("Gray", 'B', 'F', 3.34, 5);
var student2= new Person("Jerry", 'A', 'M', 3.99, 4);
document.getElementById("demo1").innerHTML= student1.Name + " " + student1.Grade + "* " + student1.Gender + *" "* + student1.GPA + " " + student1.classRank;
document.getElementById("demo2").innerHTML= student2.Name + " " + student2.Grade + "* " + student2.Gender + *" "* + student2.GPA + " " + student2.classRank;
Code:
<html>
<head>
<title></title>
</head>
<body>
<p id= "demo1"> </p>
<p id= "demo2"></p>
</body>
</html>
Comment