Calling a method on a literal value or variable initialized with a primitive value has the same effect as first coercing the value to an Object of appropriate type and then calling the method on it. The following experiment is better than trying to explain this in words:
Object.prototype.getPrototype = function() { return "Object"; };
Number.prototype.getPrototype = function() { return "Number"; };
function test(v) {
alert("proto: " + v.getPrototype()
+ ", type: " + typeof v
+ ", is a Number: " + (v instanceof Number)
+ ", is an Object: " + (v instanceof Object));
}
// proto: Number, type: number, is a Number: false, is an Object: false
test(42);
// proto: Number, type: number, is a Number: false, is an Object: false
test(Number(42));
// proto: Number, type: object, is a Number: true, is an Object: true
test(Object(42));
// proto: Number, type: object, is a Number: true, is an Object: true
test(new Number(42));