JSFiddle - React, Tailwind, and code Playground
by bingjie2680
JavaScript
function Book(title, author) {
this.title = title;
this.author = author;
}
// Replacing the default prototype object
myPrototype = new Object();
Book.prototype = myPrototype;
Book.prototype.price = 9.99;
Book.prototype.constructor = Book;
// Modifying the base prototype object
Object.prototype.copyright = "herongyang.com";
// Creating an object from my constructor
var myBook = new Book("JavaScript Tutorials", "Herong Yang");
console.log(myBook );