<html>
<script>
function Person(name) {
this.name = name;
}
Person.ptototype.getName = function() {
return this.name;
}
function Author(name, books) {
Person.call(this,name);//call the superclass's constructor
this.books = books;
}
Author.prototype = new Person();//set up the prototype chain
Author.prototype.constructor = Author; // set the constructor attribute to Author
Author.prototype.getBooks = function() {
return this.books;
}
var author = new Author('Dustin Diaz',['javascript design patterns ']);
author.getName();
author.getBooks();
</script>
</html>