<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>数组</title>
</head>
<body>
<script>
var arr = [1, 2, "炸弹", 3, 4, "炸弹", 5];
var sum = 0;
for (i = 0; i < arr.length; i++) {
if (isNaN(arr[i]) == false) {
sum += arr[i];
}
}
console.log(sum);
</script>
</body>
</html>
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星