function Book(title, author) { this.title = title; this.author = author; } Book.prototype.price = 9.99; Object.prototype.copyright = "herongyang.com"; var myBook = new Book("JavaScript Tutorials", "Herong Yang"); // Dumping built-in properties at the base prototype level document.writeln("/nObject.prototype's built-in properties:"); dumpProperty(Object.prototype, "constructor"); dumpProperty(Object.prototype, "hasOwnProperty"); dumpProperty(Object.prototype, "isPrototypeOf"); dumpProperty(Object.prototype, "toString"); dumpProperty(Object.prototype, "valueOf"); dumpProperty(Object.prototype, "copyright"); // Dumping built-in properties at the my prototype level document.writeln("/n==================/nBook.prototype's built-in properties:"); dumpProperty(Book.prototype, "constructor"); dumpProperty(Book.prototype, "hasOwnProperty"); dumpProperty(Book.prototype, "isPrototypeOf"); dumpProperty(Book.prototype, "toString"); dumpProperty(Book.prototype, "valueOf"); dumpProperty(Book.prototype, "copyright"); // Dumping built-in properties at the object level document.writeln("/n==================/nmyBook's built-in properties:"); dumpProperty(myBook, "constructor"); dumpProperty(myBook, "hasOwnProperty"); dumpProperty(myBook, "isPrototypeOf"); dumpProperty(myBook, "toString"); dumpProperty(myBook, "valueOf"); dumpProperty(myBook, "copyright"); function dumpProperty(object, property) { var inheritance; if (object.hasOwnProperty(property)) inheritance = "Local"; else inheritance = "Inherited"; document.writeln(property+": "+inheritance+": " +object[property]); } //javascript/7073