Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active August 22, 2023 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcsee/9a0f4f02514f740f3872cbc463d25c8b to your computer and use it in GitHub Desktop.
Save mcsee/9a0f4f02514f740f3872cbc463d25c8b to your computer and use it in GitHub Desktop.
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