So how do you sanity check for just an integer? Like so:
var bar = parseInt(foo); if((!bar && bar != 0) || (foo.indexOf(".") >= 0)) { alert("It's not an integer!"); } else { alert("I feel whole."); }
No comments:
Post a Comment