Ajude a dar forma ao GoConqr. O que a gente deve adicionar?

Quiz

Prototypes in Javascript

Pulkit Singhal 6 perguntas

Fazer o quiz

Perguntas do quiz (6)

  1. 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?
    1. A3
    2. Bnull
    3. Cundefined
    4. D0
  2. 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?
    1. A4
    2. B3
    3. Cnull
    4. Dundefined
    5. E0
  3. 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?
    1. A4
    2. B3
    3. Cnull
    4. Dundefined
    5. E0
  4. 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?
    1. A4
    2. B3
    3. Cnull
    4. Dundefined
    5. E0
  5. 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?
    1. Afluffy.age;
      4

      scratchy.age;
      3
    2. Bfluffy.age;
      4

      scratchy.age;
      4
    3. Cfluffy.age;
      3

      scratchy.age;
      3
  6. 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?
    1. Afluffy.age;
      4

      scratchy.age;
      3
    2. Bfluffy.age;
      3

      scratchy.age;
      3
    3. Cfluffy.age;
      4

      scratchy.age;
      4

Informações

Descrição
Measure your understanding of Javascript Prototypes
Idioma
English
Visualizações
356
Etiquetas
prototypejavascriptjavascript / nodejs
Avaliação
Ainda sem avaliações
Avalie este quiz
Avalie este quiz

Fale Conosco

Sobre o que é sua mensagem?

O que a gente deve adicionar?