var valueku = url;
for (var e = 0; e < cotLength; e++) {
if (dataprofil[e + 1].one == dataprofil[e].one) {
total = parseInt(dataprofil[e + 1].three) + parseInt(dataprofil[e].three);
total2 = parseInt(dataprofil[e].four);
sum = total * total2;
dataprofil[e].three = total;
dataprofil.splice(e + 1, 1);
}
valueku = valueku.concat(dataprofil[e].one, ":", dataprofil[e].two, "=", sum, "&");
alert("inside= " + valueku); //inside loop is 1,2,3,4,5
}
alert("outside= " + valueku); //outside loop should be the last value of valueku --> 12345
问题是为什么我只能在内部循环中看到警报消息但在循环外没有警报消息?外部循环应该是变量valueku的最后一个值。