JS设计模式源代码

源代码在线查看: 4.02 - the prototype chain.js

软件大小: 80 K
上传用户: BEIJINGHUANYING
关键词: 设计模式 源代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				/* Class Author. */								function Author(name, books) {				  Person.call(this, name); // Call the superclass' constructor in the scope of this.				  this.books = books; // Add an attribute to Author.				}								Author.prototype = new Person(); // Set up the prototype chain.				Author.prototype.constructor = Author; // Set the constructor attribute to Author.				Author.prototype.getBooks = function() { // Add a method to Author.				  return this.books;				};								var author = [];				author[0] = new Author('Dustin Diaz', ['JavaScript Design Patterns']);				author[1] = new Author('Ross Harmes', ['JavaScript Design Patterns']);								author[1].getName();				author[1].getBooks();							

相关资源