Monday, July 15, 2019

Javascript - iterating throught array



Hi i have following code



$(args.data0).find('group').each( function() ...



Variable args is create by AJAX call and it contains data0, data1, ... dataN
How can i programatically iterate over all these variables?
Something like that packed in some kind of forEach cycle :)



$(args.data0).find('group').each( function() ...
$(args.data1).find('group').each( function() ...
$(args.dataN).find('group').each( function() ...


Many thanks



Answer



for(var i = 0; i <= n; i++){
$(args['data' + i]).find('group').each( function() ...
}

No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...