Skip to main content

JavaScript Question 66

Question 66 of 0JavaScript

With which constructor can we successfully extend the `Dog` class?

Login Required

Please login to select answers and solve this question. You can view the question without logging in.

Code:
class Dog {
  constructor(name) {
    this.name = name;
  }
};

class Labrador extends Dog {
  // 1
  constructor(name, size) {
    this.size = size;
  }
  // 2
  constructor(name, size) {
    super(name);
    this.size = size;
  }
  // 3
  constructor(size) {
    super(name);
    this.size = size;
  }
  // 4
  constructor(name, size) {
    this.name = name;
    this.size = size;
  }
};

Select the correct option: