Returns a reference to the prototype for a Boolean.
Syntaxboolean.prototype
Examples
Defines a function and then adds it to Boolean.prototype
function isFalse( ){
if (this.toString() == "false")
return true;
else
return false;
}
Boolean.prototype.isFalse = isFalse;
var bool = new Boolean(1);
document.write(bool.isFalse());
Adds a function directly to the Boolean object through its prototype
Boolean.prototype.toggle = function (){
return !this.valueOf();
}
Remarks
The boolean argument is the name of an object.
The prototype property provides a base set of functionality to a class of objects. New instances of an object “inherit” the behavior of the prototype assigned to that object. Properties and methods may be added to the prototype, but builtin objects may not be assigned a different prototype.
For example, to add a method to the Boolean object that returns the value of the largest element of the array, declare the function, add it to Boolean.prototype , and then use it.
AttributionsMicrosoft Developer Network: Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4