I’m trying to fill my array with an auto-increment (listeFormatte.lenght) and it break at the line listeFormatte[listeFormatte.length][0] = cartArray[i][0]; and give can’t convert undefined object error.
cartArray[i][0] = "ensemble"
listeFormatte = "" (new array)
listeFormatte.length = 0
Thanks in advance.
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];
}
}
Edit: What is imagemagick-convert it has nothing to do with what I’m doing, why would you edit my things with stuff like that?
Answer: So when listeFormatte[listeFormatte.length] = []; create the multidimensional array it raise the listeFormatte.lenght which lead to a undefined on the “second use” because it is now: listeFormatte[1] instead of [0]. So I added a variable which get the listeFormatte.length.
Did you consider
listeFormatte[listeFormatte.length] = new Array;I never seen the
listeFormatte[listeFormatte.length] = [];construct before, and without something like that yourlisteFormatte[listeFormatte.length]is NOT defined as array, so you can not use [0] index.