Make a new method for the Boolean object:
Make a Boolean object, then calls the myColor method:
The value of b is now:
Try it yourself »
Definition and Usage
The prototype constructor allows you to add new properties and methods to the Boolean() object.
When constructing a property, ALL booleans will be given the property, and it's value, as default.
When constructing a method, ALL booleans will have this method available.
Note: Boolean.prototype does not refer to a single boolean, but to the Boolean() object itself.
The prototype property is supported in all major browsers.
Thank You For Helping Us!
Your message has been sent to W3Schools.