我有存储阵列的阵列。我需要从这个数组中提取特定的值。
I have an array of array stored. I need to extract the particular value from this arrays.
例如allarray包含数组列表allarray = [阵列[3],阵列[3],数组[3]是三阵列present
e.g allarray contain the list of arrays allarray= [Array[3],Array[3],Array[3]] are three arrays present in that.
0:数组[3] 0:A1 1:B1 2:C1
0:Array[3] 0:"a1" 1:"b1" 2:"c1"
1:数组[3] 0:A2 1:B2 2:C2
1:Array[3] 0:"a2" 1:"b2" 2:"c2"
3:数组[3] 0:A3 1:B3 2:C3
3:Array[3] 0:"a3" 1:"b3" 2:"c3"
我需要提取该C1,从上述阵列和显示在警报框c2和c3
I need to extract this c1,c2 and c3 from the above arrays and display in the alert box.
谁能告诉我,我该怎么办呢?
Can anyone tell me how i can do that?
我试着用$。每个可惜不工作。任何人都可以?
i tried with $.each but unfortunately doesn't work. Can anyone?
推荐答案如果我理解正确,你的阵列看起来像这样
If I understand you correctly, your array looks like this
var allarray = [["a1","b1","c1"],["a2","b2","c2"],["a3","b3","c3"]];要获得C1,C2和C3你可能只是做到这一点。
To get c1, c2, and c3 you could just do this
var c1 = allarray[0][2], c2 = allarray[1][2], c3 = allarray[2][2];或你可以做一个循环来把所有的CS在自己的单个阵列
or you could do a loop to put all of the cs in a single array of its own
var cs = []; for(var i = 0; i < allarray.length; i++) { cs.push(allarray[i][2]); }更多推荐
如何从数组的数组中获取价值
发布评论