If you look at 8.7.2 ECMA 5.1 , you will notice this note below:
The object that can be created in step 1 is not available outside the above method. An implementation may decide to avoid actually creating this transition object. The only situations where such an actual property assignment that uses this internal method can have a visible effect when it either calls the access function or violates the established Throw error check. When Throw is true, any property assignment that would create a new property on the transition object throws an error.
Step 1 - Let O be ToObject(base).
If you look at the ToObject() method in 9.9 , you will find these two rows in the table:
Create a new Number object whose internal [[PrimitiveValue]] property is set to the value of the argument. See 15.7 for a description of Number objects.
The result is an input argument (no conversion).
It looks like this when you try to set a function to a number, it actually happens (albeit in the form of noop), it becomes inaccessible after the assignment due to the assignment executed on the internal transition object. When you do this on a regular object, it returns the actual object, so the assignment makes sense.
source share