sum+=parseInt(scores)和sum+=parseInt(scores[i])的区别
<!DOCTYPE HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>系好安全带,准备启航</title>
<script type="text/javascript">
var scoreStr = "小明:87;小花:81;小红:97;小天:76;小张:74;小小:94;小西:90;小伍:76;小迪:64;小曼:100";
var arr = scoreStr.split(';');
var arr = scoreStr.split(';');
var sum = 0;
for( var i =0;i<arr.length;i++ ){
var scores = arr[i].substr(arr[i].indexOf(':')+1);
sum+=parseInt(scores);
}
var avvv=sum/arr.length;
document.write(Math.floor(avvv));
</script>
</head>
<body>
</body>
</html>
在这个代码中 如果sum+=parseInt(scores)就能输出正常结果,但是sum+=parseInt(score[i])就输出的是NAN 。这两句话有什么区别?