Make a new method for the Boolean object:
Make a Boolean object, then calls the myColor method:
The value of b is now:
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.
Note: Prototype is a global object constructor which is available for all JavaScript objects.
![]()
The prototype property is supported in all major browsers.
JavaScript Boolean Object
Your message has been sent to W3Schools.