var t1 = { students: [], class: 'A', record: function(student) { if (student.class === this.class) { this.students.push(student); console.log(`t1 have record ${student.name}`); } else { this.transmit(student) } }, transmit: function(student) { t2.record(student) } }
var t2 = { students: [], class: 'B', record: function(student) { if (student.class === this.class) { this.students.push(student); console.log(`t2 have record ${student.name}`); } else { this.transmit(student) } }, transmit: function(student) { t3.record(student) } }
var t3 = { students: [], class: 'C', record: function(student) { if (student.class === this.class) { this.students.push(student); console.log(`t3 have record ${student.name}`); } else { this.transmit(student) } }, transmit: function(student) { console.log(`the class of ${student.name} may be wrong`); } }
var t1 = { students: [], class: 'A', nextPoint: {}, record: function(student) { if (student.class === this.class) { this.students.push(student); console.log(`t1 have record ${student.name}`); } else { this.transmit(student) } }, transmit: function(student) { if (this.nextPoint !== {}) this.nextPoint.record(student); else console.log(`the class of ${student.name} may be wrong`); } }
var t2 = { students: [], class: 'B', nextPoint: {}, record: function(student) { if (student.class === this.class) { this.students.push(student); console.log(`t2 have record ${student.name}`); } else { this.transmit(student); } }, transmit: function(student) { if (this.nextPoint !== {}) this.nextPoint.record(student); else console.log(`the class of ${student.name} may be wrong`); } }
var t3 = { students: [], class: 'C', nextPoint: {}, record: function(student) { if (student.class === this.class) { this.students.push(student); console.log(`t3 have record ${student.name}`); } else { this.transmit(student); } }, transmit: function(student) { if (this.nextPoint !== {}) this.nextPoint.record(student); else console.log(`the class of ${student.name} may be wrong`); } }