Why is Number.prototype a Number

ecmascript-5, javascript

Solution

In general, `Constructor.prototype` is an exemplar of the "type" defined by `Constructor`. Although things seem to get hairy for immutable primitives, and especially once you involve the boxing stuff, this exemplar concept still makes sense, with `0` being the "exemplar" of `Number`.

Problem

``` ({}).toString.call(Number.prototype) === "[object Number]" ``` The Number prototype object is itself a Number object (its [[Class]] is "Number") whose value is +0. 15.7.4 Why would it be useful for `Number.prototype` to be a Number? (the same goes for every other built-in prototype which has the [[Class]] set to not Object) I'm picking on `Number.prototype` specifically because I can imagine sensible legacy reasons for `Array.prototype` and `Date.prototype`.

Original source