Quiz
Prototypes in Javascript
Erstelle ein kostenloses Konto, um dieses Quiz zu beenden
Speichere deinen Fortschritt und sieh dir dein Endergebnis an.
oder mit deiner E-Mail registrieren
Schon ein Konto? Anmelden
Fragen in diesem Quiz (6)
1function Cat(name, color) {
this.name = name;
this.color = color;
}
Cat.prototype.age = 3;
var fluffy = new Cat("Fluffy", "White");
var scratchy = new Cat("Scratchy", "Black");
What is the value for fluffy.age and scratch.age?- A3
- Bnull
- Cundefined
- D0
2Given that a function’s prototype is just an object, then what would happen if we started changing the properties of a function’s prototype after we created objects from it?
function Cat(name, color) {
this.name = name;
this.color = color;
}
Cat.prototype.age = 3;
var fluffy = new Cat("Fluffy", "White");
var scratchy = new Cat("Scratchy", "Black");
Cat.prototype.age = 4;
What is the value for fluffy.age and scratchy.age?- A4
- B3
- Cnull
- Dundefined
- E0
3function Cat(name, color) {
this.name = name;
this.color = color;
}
Cat.prototype.age = 3;
var fluffy = new Cat("Fluffy", "White");
var scratchy = new Cat("Scratchy", "Black");
Cat.prototype = {age: 4};
What is fluffy.age and scratchy.age?- A4
- B3
- Cnull
- Dundefined
- E0
4function Cat(name, color) {
this.name = name;
this.color = color;
}
Cat.prototype.age = 3;
var fluffy = new Cat("Fluffy", "White");
var scratchy = new Cat("Scratchy", "Black");
Cat.prototype = {age: 4};
var muffin = new Cat("Muffin", "Brown");
What is muffin.age?- A4
- B3
- Cnull
- Dundefined
- E0
5function Cat(name, color) {
this.name = name;
this.color = color;
}
Cat.prototype.age = 3;
var fluffy = new Cat("Fluffy", "White");
var scratchy = new Cat("Scratchy", "Black");
fluffy.age = 4;
What is fluffy.age and scratchy.age?- Afluffy.age;
4
scratchy.age;
3 - Bfluffy.age;
4
scratchy.age;
4 - Cfluffy.age;
3
scratchy.age;
3
- Afluffy.age;
6function Cat(name, color) {
this.name = name;
this.color = color;
}
Cat.prototype.age = 3;
var fluffy = new Cat("Fluffy", "White");
var scratchy = new Cat("Scratchy", "Black");
fluffy.__proto__.age = 4;
What is fluffy.age and scratchy.age?- Afluffy.age;
4
scratchy.age;
3 - Bfluffy.age;
3
scratchy.age;
3 - Cfluffy.age;
4
scratchy.age;
4
- Afluffy.age;
Informationen
- Beschreibung
- Measure your understanding of Javascript Prototypes
- Autor
- Pulkit Singhal
- Sprache
- English
- Aufrufe
- 356
- Schlagwörter
- Bewertung
- Noch keine Bewertungen Bewerte dieses Quiz