Question: I'm new to JS and have a question about inheritance. How are inherited properties accessed through the child class?

Lets say I have the following classes:

```
function ParentClass(parentArg) {
    this.parentProperty = parentArg;
}

function ChildClass(childArg1, childArg2) {
    this.prototype = new ParentClass(childArg1);
    this.childProperty = childArg2;
}

```

And at some point an object is created of ChildClass, like so:

```
var foo = new ChildClass('value 1', 'value 2');

```

Then how can a parent property be accessed from the instance of the child? The following returns 'undefined'.

```
var parentValue = foo.parentProperty;

```

Much appreciated.
Cheers

Answer: 
If you want to initialize the `parentProperty`, you have to do it like this

```
function ParentClass(parentArg) {
    this.parentProperty = parentArg;
}

function ChildClass(childArg1, childArg2) {
    ParentClass.call(this, childArg1);
    this.childProperty = childArg2;
}

```

And to actually inherit Parent't methods, you might want to do

```
ChildClass.prototype = Object.create(ParentClass.prototype);

```

After making these changes, 

```
var foo = new ChildClass('value 1', 'value 2');
console.log(foo);
# { parentProperty: 'value 1', childProperty: 'value 2' }

```
`foo.prototype.parentProperty` If you want to get `value 1` back