Prototypes page

Learn how to explore an object’s proto chain.

The problem

What is the value of frozen’s rated property that it inherited from the Entertainment prototype?

<script src="//"></script>
<script type="module">
var Movie = function(){};
Movie.prototype = new Entertainment(); = function(){};

var AnimatedMovie = function(){};
AnimatedMovie.prototype = new Movie();
AnimatedMovie.prototype.isAnime = function(){};

var frozen = new AnimatedMovie();
console.log("frozen has a `rated` property, inherited from Entertainment. What is its value?")

What you need to know

The following sets up the same Animal, Chordate, and Mammal inheritance chain from the Prototypes JavaScript course.

Animal = function(name) { = name; };
Animal.prototype.eats = function(){ return" eats."; };

function Chordate(name){ = name; };
Chordate.prototype = new Animal();
Chordate.prototype.hasSpine = true;

function Mammal(name){ = name; };
Mammal.prototype = new Chordate();
Mammal.prototype.hasHair = true;

var m = new Mammal('dog');

You can inspect the Mammal instance m and see its __proto__ property:

The solution

Click to see the answer

The answer is b.