Search⌘ K
AI Features

Challenge: Prototypal Inheritance

Explore how to implement prototypal inheritance between the classes Human and Man in JavaScript. This challenge helps you identify and fix issues with undefined outputs while strengthening your understanding of object-oriented programming concepts relevant for coding interviews.

We'll cover the following...

Problem statement

Study the code given below and then run it.

Javascript (babel-node)
function Human(name, age) {
this.name = name;
this.age = age;
};
function Man(name) {
};
function check(){
var obj = new Man("Tommy Tan");
console.log(obj.name)
console.log(obj instanceof Human)
}
check()
...