Which of the following statements about implementing collection-valued properties in JS are correct? Select one or more:
☐ A bag-valued property is implemented by representing bags (also called 'multi-sets') as JS arrays.
☐ A set-valued property is preferably implemented by representing sets as JS arrays since, as opposed to JS maps, they guarantee that each element is unique.
☐ An ordered-set-valued property is implemented by representing ordered sets as JS maps.
☐ An ordered-set-valued property is implemented by representing ordered sets as JS arrays.
☐ A set-valued property is preferably implemented by representing sets as classical JS maps since, as opposed to JS arrays, they guarantee that each element is unique.
☐ A bag-valued property is implemented by representing bags (also called 'multi-sets') as JS maps.
Making the assumption that books existentially depend on their
authors, implying a CASCADE deletion policy, which of the following
Author.destroy methods correctly implements the implied
deletion policy? Select one:
O
Author.destroy = function (authorId) {
for (const isbn of Object.keys( Book.instances)) {
const book = Book.instances[isbn];
if (authorId in book.authors) delete book.authors[authorId];
}
delete Author.instances[authorId];
};O
Author.destroy = function (authorId) {
for (const isbn of Object.keys( Book.instances)) {
const book = Book.instances[isbn];
if (authorId in book.authors) book.authors[authorId] = null;
}
delete Author.instances[authorId];
};O
Author.destroy = function (authorId) {
for (const isbn of Object.keys( Book.instances)) {
const book = Book.instances[isbn];
if (authorId in book.authors) delete Book.instances[isbn];
}
delete Author.instances[authorId];
};