Answer the question
In order to leave comments, you need to log in
How to iterate over an array without a double loop?
In short, the goal is to choose cards (Instagram) in which there is my like.
Now I do it like this. Can anyone suggest a more elegant way? jQuery is present
var photos= data.data;
for (var i= 0; i<options.count; i++) {
var photo_card=photos[i]; //Карточка фоты
for (var k=0; k<photo_card.likes.data.length; k++)
if (photo_card.likes.data[k].username == options.myUsername)
$this.append("<li><img src='"+photo_card.images.low_resolution.url+"'></li>")
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question