Comment

Tex

Manuel SIMONOT feeling was right, there is useless parts. But he picked the really wrong one...

function isInt(n) {
return n.toString()==parseInt(n).toString();
}
// 'a' != 'NaN' so 'a' is not an Int
// '1.0' != '1' so '1.0' is not an Int

Peter want "1.0" to be false. So n%1==0 is the wrong test for that. But this request is, in a way, absurd. "1.0" is findable as being a Float. 1.0 can't. It is parsed from Float to Int before being send to the function. Displaying a 1.0 can only be done from a string. alert(1.0); give 1. And the test wrote in the article doesn't test Integer or Float, only String.