Despite possible problems with adding your own prototypes to MSIE, your function body is not suitable for the method added to Number.prototype .
Prototype methods are called on type instances, and the instance is passed as this (and will always be an object, not a primitive).
Therefore, a more correct implementation:
Number.prototype.isInteger = function() { return (this ^ 0) === +this; }
using:
(1).isInteger();
If you want to use Number.isInteger(n) instead, you would have to add your function directly to the Number object, and not to its prototype. To do this, on the MDN page for this function there is a strict gasket .
source share