["57300","730","17300","17330","17340","70","220","320","380","420","340","130","50","280","360","550","43110","44340","400","620","440","20","72850"]
是一个字符串数组被传递回一个javascript函数,该函数继续对其进行工作以将其分解为一个字符串数组(使用带有“,”作为分隔符的拆分函数)。
这里的问题是,我需要将之后的每一个都转换为整数。听起来很容易。
所以我继续做一个:
$.each(data, function(i, item)
在上面。如果我控制台记录该项目,我可以看到它是“57300”、“730”等。这很好。但如果我尝试这样做:
var number = parseInt(item, 10);
控制台记录什么数字是......它的NaN(不应该是57300、730等没有引号吗?)。是一些隐藏的字符惹恼了我导致 parseInt 中断吗?