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? Select one:
O
set chair(c) {
const clubMember_id = (typeof c !== "object") ? c : c.memberId;
this._chair = ClubMember.instances[clubMember_id];
}O
set chair(c) {
const clubMember_id = c.memberId;
this._chair = ClubMember.instances[clubMember_id];
}O
set chair(c) {
const clubMember_id = c;
this._chair = ClubMember.instances[clubMember_id];
}O
set chair(c) {
this._chair = c;
}Making the assumption that books existentially depend on their
publishers, implying a CASCADE deletion policy, which of the following
Publisher.destroy methods correctly implements the implied
deletion policy? Select one:
O
Publisher.destroy = function (name) {
for (const key of Object.keys( Book.instances)) {
const book = Book.instances[key];
if (book.publisher.name === name) {
delete book._publisher;
}
}
delete Publisher.instances[name];
};O
Publisher.destroy = function (name) {
for (const key of Object.keys( Book.instances)) {
const book = Book.instances[key];
if (book.publisher.name === name) {
delete Book.instances[key];
}
}
delete Publisher.instances[name];
};O
Publisher.destroy = function (name) {
for (const key of Object.keys( Book.instances)) {
const book = Book.instances[key];
if (book.publisher.name === name) {
book.publisher = undefined;
}
}
delete Publisher.instances[name];
};