Quiz 15: ES 6 Classes
Question 1
Shows
true?JavaScript
class Person {
constructor(name) {
this.name = name;
}
isCool() { return this.name.length > 3};
}
const p = new Person("Dierk");
p.isCool()Question 2
Shows
true?JavaScript
class Person {
constructor(name) {
this.name = name;
}
isCool() { return this.name.length > 3};
}
const p = new Person("Dierk");
p.name === "Dierk"Question 3
Shows
true?JavaScript
class Person {
constructor(name) {
this.name = name
}
isCool() { return name === 'Dierk'};
}
const p = new Person("Dierk");
p.isCool()Question 4
Shows
true?JavaScript
class Person {
constructor(name) {
this.name = name;
}
isCool() { return this.name.length > 3};
}
const p = new Person("Dierk");
const joe = {
name: "Joe",
cool: p.isCool
};
joe.cool()Question 5
Shows
true?JavaScript
class Person {
constructor(name) {
this.name = name;
}
isCool() { return this.name.length > 3};
}
const p = new Person("Joe");
Person.prototype.isCool = () => true;
p.isCool()Question 6
Shows
true?JavaScript
class Person {
constructor(name) {
this.name = name;
}
isCool() { return this.name.length > 3};
}
const p = new Person("Joe");
p.isCool = () => true;
p.isCool()Question 7
Shows
true?JavaScript
class Person {
constructor(name) {
}
isCool() { return this.name.length > 3};
}
const p = new Person("Dierk");
p.isCool()Question 8
Shows
true?JavaScript
class Person {
constructor(name) {
this.name = name;
}
isCool() { return this.name.length > 3};
}
const p = new Person("Joe");
p.prototype.isCool = () => true;
p.isCool()Question 9
Shows
true?JavaScript
class Person {
constructor(name) {
this.name = name;
}
isCool() { return this.name.length > 3};
}
const p = new Person("Joe");
p.name = "Dierk";
p.isCool()