-1
我想要的值如下分配到一個數組位置:錯誤指定位置數組
//Javascript file
var totales = new Array();
$('.total').each(function(){
var id = $(this).attr("id");//value of id => "empresa_bundle_revision_capitulos_1_requisitos_1_articulos_1_total"
var arrayids = id.split("_");
if(totales[arrayids[4]] == undefined){
totales[arrayids[4]] = new Array();
}
}
在的console.log我得到這個怎麼totales值:
[undefined, []]
這應該返回類似於:
[[]]
問題在哪裏?
添加帶'.total'類的html。 –
'arrayids [4]'yeilds是什麼? – candidJ
arrayids [4] return「1」 –