日期:2014-05-17 浏览次数:20798 次
var regex = /[^\d]+/; var arr = ["1","2","3","a","b","c","a1","2b2"]; for(o in arr) { var bool = regex.test(arr[o]); document.write(arr[o]+"-"+bool+"<br/>"); }
------解决方案--------------------
var regex = /[^\d]+/;
var arr = ["1","2","31111a","a","b","c","a1","2b2"];
for(o in arr)
{
var bool = isNaN(arr[o]);
document.write(arr[o]+"-"+bool+"<br/>");
}
--其实isNaN更好啊
------解决方案--------------------
变量.typeof = "string";