prototype (Boolean - JavaScript)

Extends the object with additional properties and methods.

Defined in

Boolean (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

(1) This computed label displays true or false.
Boolean.prototype.T = true;
Boolean.prototype.F = false;

var b = new Boolean();
b.T.toString() + " or " + b.F.toString()
(2) This computed label defines a function for the Boolean object then calls it.
Boolean.prototype.admin = function() {
	if(session.getCommonUserName().indexOf("admin") == 0)
		return false;
	else return true;
}

var b = new Boolean();
if(b.admin())
	return "Admin"
else
	return "End user"