Good day. Gentlemen, I'm desperate. There is:
var subparts=[ [0,'Раздел_1',10,0], [1,'Раздел_2',10,1], [2,'Раздел_3',10,2], ... ]; var items=[ [0,'Пункт_1','параметр_1','параметр_2',10,0], [1,'Пункт_2','параметр_1','параметр_2',10,1], [2,'Пункт_3','параметр_1','параметр_2',10,2], ... ]; for (var k =0, subpart_id, i=0; k < subparts.length; k++) { console.log(subparts[k][1]); for (; k == items[i][5]; i++) { console.log(' '+items[i][1]); } }
As I want - a walk through the array, if the subparts contains some items from items, they are listed below. What turns out - this is how it turns out, but for some reason the console gives out “Uncaught TypeError: Cannot read property '5' of undefined” (and this: fire in jquery-1.8.3.js: 974 , self.fireWith in jquery-1.8 .3.js: 1084 , jQuery.extend.ready in jquery-1.8.3.js: 406 , DOMContentLoaded in jquery-1.8.3.js: 83 ). What does this mean?