I'm puzzled by a strange issue I've come across. Here's what's happening: I declare an array called status=new Array()
. Then, I loop through from 0
to N-1
, and assign status[i]="idle";
. When I try to check the values using alert, they all show up as a comma character ,
. Can anyone help me figure out what's causing this unexpected behavior?
var status=new Array();
window.onload = function() {
for(var i=0;i<5;i++) {
status[i]="idle";
alert(status[i]);
}
}