Quiz: Unidirectional Functional Associations
Take a short quiz on unidirectional functional associations.
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;
}
Question 1 of 30 attempted
Get hands-on with 1400+ tech skills courses.