prototype (Date - JavaScript)

Extends the object with additional properties and methods.

Defined in

Date (Standard - JavaScript)

Syntax

prototype.name = value
Parameters Description
name The name of the property or method.
value The value of the property or method. For a property, this should be an expression. For a method, this should be a function definition.

Examples

This computed label defines a function for the Date object then calls it.
Date.prototype.tomorrow = function() {
	this.setDate(this.getDate() + 1);
}

var date = new Date();
date.tomorrow(); // advances the date 1 day
date.toString()