You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your isInteger function breaks for values over 2^31-1:
> function isInteger(x) { return (x^0) === x; } // your function
undefined
> isInteger(Number.MAX_SAFE_INTEGER)
false
> Number.MAX_SAFE_INTEGER
9007199254740991
> function isInteger2(x) { return Math.round(x) === x } // actual working function
undefined
> isInteger2(Number.MAX_SAFE_INTEGER)
true
> Number.isInteger(Number.MAX_SAFE_INTEGER) // ES6 function
true
The text was updated successfully, but these errors were encountered:
Your isInteger function breaks for values over 2^31-1:
The text was updated successfully, but these errors were encountered: