Create a method that gives the number object a property that returns the number's half value:
Make a Number object, then call the myMet method:
The result of x will be:
The prototype constructor allows you to add new properties and methods to the Number() object.
When constructing a property, ALL number objects will be given the property, and its value, as default.
When constructing a method, ALL number objects will have this method available.
Note: Number.prototype does not refer to a single number object, but to the Number() 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 Number Object
Your message has been sent to W3Schools.