...

/

Quiz: Unidirectional Functional Associations

Quiz: Unidirectional Functional Associations

Take a short quiz on unidirectional functional associations.

We'll cover the following...
Technical Quiz
1.

Consider the single-valued reference property Committee::chair, which holds a reference to an instance of the class ClubMember.

Which of the following JS code fragments represents the preferred implementation of the setter for this property?

A.
set chair(c) {
  const clubMember_id = (typeof c !==  "object") ? c : c.memberId;
  this._chair = ClubMember.instances[clubMember_id];
}
B.
set chair(c) {
  const clubMember_id = c.memberId;
  this._chair = ClubMember.instances[clubMember_id];
}
C.
set chair(c) {
  const clubMember_id = c;
  this._chair = ClubMember.instances[clubMember_id];
}
D.
set chair(c) {
  this._chair = c;
}

1 / 3