loops - Looping through two arrays simultaneously -
What is the best way to loop and simultaneously output the value of 2 arrays?
Here the value of two arrays refers to the key position of two other arrays, respectively, illustrated by the picture and description. Therefore, the integer values of the loop these arrays should not be output, but the value assigned to the corresponding keys in the reference array.
var imgindex = [0,1,3]; Var detailindex = [2,4,6]; $ (Imgindex) .each (function (i, o) {$ ("# line"). App ("& lt; img src = '" + images [o] + ".png' / & gt; & lt; Div & gt; "+ Details [O] +" );});
Call on an array and use the index to get the elements.
$ (imgIndices) .each (function (index, elem) {$ ("# Row2-extension"). Attachments ("& lt; img src = '{$ base_dir_ssl} img / cms /" + images [[index] [index]] + ".png' /> here viv O Index [index] I will index Description array.
Comments
Post a Comment