JS: Number.prototype
What is Number.prototype
Number.prototype
is the value of the property key "prototype"
of the function Number
.
[see Number Object]
Number.hasOwnProperty ( "prototype" )
Type
Type of Number.prototype
is Object
.
typeof Number.prototype === "object"
Number.prototype
is actually a number. It has a value of 0.
console.log( Reflect.apply ( Object.prototype.toString , Number.prototype , [] ) === "[object Number]" ); console.log( Reflect.apply ( Number.prototype.valueOf, Number.prototype, [] ) === 0 );
Parent
Parent of Number.prototype
is Object.prototype
.
Reflect.getPrototypeOf ( Number.prototype ) === Object.prototype
Purpose
Purpose of Number.prototype
is to provide methods and properties useful for all number objects.
Properties
Convert to string:
Other:
constructor
-
Value is
Number
. [see Number Object]Number.prototype.constructor === Number
valueOf
-
Return the number as primitive value.
(new Number(3)).valueOf() === 3
toLocaleString
-
Return a string that represents this number, formatted according to the conventions of the host environment's current locale. Implementation-dependent. May be the same as Number.prototype.toString.
JavaScript, Number
- JS: Number
- JS: Assignment Operators
- JS: Math Operators
- JS: Number Comparison Operators
- JS: Convert String, Number
- JS: Convert Decimal, Hexadecimal
- JS: Convert Decimal, Binary
- JS: Format Number
- JS: Random Integer Range Function ð
- JS: Number Object
- JS: Number Constructor
- JS: Number.prototype
- JS: Math