我要构建两个相关的数组,但是会出错
while(phpcnt)
{
pre_id=id
pre_selected[track]['id']=some id;
pre_selected[track]['price']=some no;
console.log(pre_selected[track]['id']);
console.log(pre_selected[track]['price']);
phpcnt=phpcnt-1;
track=track+1;
}
这是数组声明
var pre_selected=new Array();
,错误为TypeError: pre_selected[track] is undefined