Wikipedia challenge: multidimensional loop through results

Wikipedia challenge: multidimensional loop through results


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:

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.


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]]