Last active
August 22, 2023 00:06
-
-
Save mcsee/9a0f4f02514f740f3872cbc463d25c8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Teacher { | |
constructor(fullName) { | |
this.fullName = fullName; | |
} | |
} | |
class School { | |
constructor(address) { | |
this.address = address; | |
} | |
} | |
class Student { | |
constructor(firstName, lastName, teacher, school) { | |
this.firstName = firstName; | |
this.lastName = lastName; | |
this.teacher = teacher; | |
this.school = school; | |
} | |
} | |
// The ids are no longer needed since they don’t exist in the real world. | |
// If you need to expose a School to an external API or a database, | |
// another object (not school) | |
// will keep the mapping externalId<->school and so on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment