Quiz

A short quiz to test your understanding of Inheritance in JavasScript.

1

If we create 50 Animal object instances, how many definitions of method getName and property name will we have?

function Animal(name,age ) {
    this.name = name
    this.age = age
}
Animal.prototype.getName = function() {
    return this.name
}
Animal.prototype.getAge = function() {
    return this.age
}
A)

getName: 1 , name: 1

B)

getName: 1, name: 50

C)

getName: 50, name: 1

D)

getName: 50, name: 50

Question 1 of 80 attempted

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy