@Dormilich Are they just pointing at each other? If so, how can I get my objects to just point at each other?
What is an Object Graph and how can it be implemented in my JavaScript code
Collapse
X
-
@Dormilich I know that was a simple example, but how can it be done using my objects in my JS file. For example with this JavaScript code below:
var*student1=*n ew*Person("Gray ",*'B',*'F',*3. 34,*5);
var*student2=*n ew*Person("Jerr y",*'A',*'M',*3 .99,*4);*Comment
-
Your post #1 code had too many errors.
See what was fixed here and maybe begin your question again (?)
What is it that you are really trying to do?Code:<html> <head> <title></title> </head> <body> <p id= "demo1"> </p> <p id= "demo2"></p> <script> 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; </script> </body> </html>Comment
Comment