If you would like to look up the answers to the following quiz questions, you can check our discussion forum. If you don't find an answer in the forum, you may create a post asking for an answer to a particular question.
Consider the following class definition:
class Book {
constructor ({isbn, title, languages}) {
this.isbn = isbn;
this.title = title;
this.languages= languages;
}
...
}
Which of the following expressions represent a correct invocation
of the Book
constructor? Select one or many:
☐
let b = new Book("006251587X", "Weaving the Web", [1,3]);
☐
let b = new Book({"006251587X", "Weaving the Web", [LanguageEL.DE,LanguageEL.FR]});
☐
let b = new Book({isbn:"006251587X", title:"Weaving the Web", languages:[1,3]});
☐
let b = new Book({ isbn: "006251587X", title: "Weaving the Web", languages: [LanguageEL.DE, LanguageEL.FR] });
Which of the following code fragments represent correct definitions of a class with implicit getters/setters such that in the constructor, implicit setters are invoked? Select one or many:
☐
class Book { constructor (i) {setIsbn(i);} get isbn() {return this._isbn;} set isbn(i) {this._isbn = i;} }
☐
class Book { constructor (i) {this.isbn = i;} get isbn() {return this._isbn;} set isbn(i) {this._isbn = i;} }
☐
class Book { constructor (i) {this.isbn = i;} get isbn() {return this.isbn;} set isbn(i) {this.isbn = i;} }
☐
class Book { constructor (i) {this._isbn = i;} get isbn() {return this._isbn;} set isbn(i) {this._isbn = i;} }
Consider the following HTML select
element:
<select name="languages" multiple="multiple">
<option value="en">English</option>
<option value="fr">French</option>
<option value="de">German</option>
</select>
Which of the following expressions represent a correct invocation
of the Book
constructor? Select one:
O
document.getElementsByName("languages")[0].options
O
document.getElementsByName("languages")[0].value
O
document.getElementsByName("languages")[0].selectedOptions