Hard
What will be the** first thing** that the following code displays?
function Item() {
this.name = 'item';
};
Item.prototype.take = function() {
console.log('You can take' + this.name);
};
function Lantern() {
this.name = 'lantern';
this.light= function() {
console.log('Light the' + this.name);
}
};
Lantern.prototype = Object.create(Item.prototype);
Lantern.prototype.constructor = Lantern;
var lantern = new Lantern();
setTimeout(lantern.light, 1);
lantern.take();
Author: Jean-marie CléryStatus: PublishedQuestion passed 2050 times
Edit
Similar QuestionsMore questions about Javascript