Wikipedia challenge: multidimensional loop through results

Wikipedia challenge: multidimensional loop through results
0

#1

I’m stuck in the wikipedia challenge. So far the search button is working correctly and wikipedia is returning the results. I’m struggling with the formatting of these results and turning them into useful data.

The results wikipedia is returning look like this: http://jsoneditoronline.org/?id=a97ff04f2c7fd5323704e695d4483f01

To display the articles correctly I have to create a loop that puts together all data where data[ï][j] loops over i while j is a fixed number.

For example: var result = data [i][0] groups together the first article’s Title, Text and Link.

I was trying to create a for loop like this but this puts together the wrong values in results.

for(var i=1; i<data.length; i++){
var result = data [i]
for (var j=0; j<result.length; j++){

}
}

Can someone help me with this one? Seems like an easy thing to do but i’m really struggling how to keep the correct index fixed.


#2

This will create an array result with values grouped in arrays.

var result = [];

for (var i = 0; i < data[1].length; i++) {
  var temp = [data[1][i], data[2][i], data[3][i]]
  result.push(temp);
}