Boolean.prototype

JavaScript 1.1+, ECMAScript 1.0+, JScript 3.0+ Nav3+, IE 4+ Syntax

Boolean.prototype.property

Boolean.prototype.method
						

Description

The prototype property allows you to add new properties and methods to the Boolean object that can be used throughout your code.

Example

In Listing 6.64, the prototype property is used to create a new method, called letter(), which can be used by all Boolean objects. The letter() method uses the letterBoolean() function to return T or F based on the status of the object.

Listing 6.64 Assigning a New Method to the Boolean Object with the prototype Property
 <html> <script language="JavaScript"> <!–– Hide //This function returns the string "T" or "F" based on the value stored in the //Boolean ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.