Jquery多维数组:can';t转换未定义的对象

Jquery多维数组:can';t转换未定义的对象,jquery,arrays,object,multidimensional-array,undefined,Jquery,Arrays,Object,Multidimensional Array,Undefined,我试图用一个自动增量(listeFormatte.lenght)填充数组,它在listeFormatte[listeFormatte.length][0]=cartArray[I][0]行中断和give无法转换未定义的对象错误 cartArray[i][0] = "ensemble" listeFormatte = "" (new array) listeFormatte.length = 0 提前谢谢 var listeFormatte = new Array; for(var i=0

我试图用一个自动增量(listeFormatte.lenght)填充数组,它在
listeFormatte[listeFormatte.length][0]=cartArray[I][0]行中断
和give无法转换未定义的对象错误

cartArray[i][0] = "ensemble"

listeFormatte = "" (new array)

listeFormatte.length = 0
提前谢谢

var listeFormatte = new Array;

for(var i=0;i<cartArray.length;i++)
{
    if(cartArray[i][0] == "ensemble")
    {
        listeFormatte[listeFormatte.length] = [];
        listeFormatte[listeFormatte.length][0] = cartArray[i][0];
    }
}
var listeformate=新数组;
对于(var i=0;i)您考虑过吗?
listeFormatte[listeFormatte.length]=新数组;


我以前从未见过
listeFormatte[listeFormatte.length]=[];
构造,如果没有类似的东西,您的
listeFormatte[listeFormatte.length]
没有定义为数组,因此您不能使用[0]索引。

如果没有listeFormatte[listeFormatte.length]=[]它会给出相同的错误;我也尝试过使用ListFormatte[ListFormatte.length]上的推送功能,但得到了相同的错误是的,我尝试过,结果完全一样。非常确定=[]只是jqueryI的另一种说法。我刚刚意识到问题是什么:在这一行之后
ListFormatte[ListFormatte.length]=[]
执行你认为ListFormatte.length的值是多少?哦,就是这样。谢谢你的帮助!我没有看到这一点真是太愚蠢了。我也直到后来才注意到它,所以不要自责。