ES6 - Date Property prototype
The prototype property allows you to add properties and methods to any object (Number, Boolean, String, Date, etc.). Note: Prototype is a global property which is available with almost all the objects.
object.prototype.name = value
var myBook = new book("Perl", "Mohtashim"); book.prototype.price = null; myBook.price = 100; console.log("Book title is : " + myBook.title + "<br>"); console.log("Book author is : " + myBook.author + "<br>"); console.log("Book price is : " + myBook.price + "<br>");
The following output is displayed on successful execution of the above code.
Book title is : Perl Book author is : Mohtashim Book price is : 100