I have 2 api calls, and they both push values into a multidimensional array, in order to associate the corresponding value results from the api calls.
When I run the following:
console.log(JSON.stringify(spacetime), null, "\t");
The console gives me:
[
{
"Title":
[
"Battle of Baekgang","Victory Tests","Everett massacre"
],
"Space": [
"United States"
],
"Time": [
"27 - 28 August 663 CE ",
"27 - 28 August 663 CE 19 May 1945 – 22 August 1945 ",
"27 - 28 August 663 CE 19 May 1945 – 22 August 1945 November 5, 1916 "
]
}
]
But the values don't match, I have 3 objects with Title, one with Space and 3 with Time
This is the jsFiddle, it is a bit long so a bit of quick guide:
On line
69we run the first set of calls withwikiText(),500, they need to be this much otherwise we wouldn't find results matching the criteria. And we push the currenttitleand the currentdatelike this:spacetime[0].Title.push(curTitle); spacetime[0].Time.push(d);On this call we do a lot of checks, but we want to concentrate on the lines
108-128-149and169, basically these are the lines that run the secondapi call:countryPage();
On the second api call, we check if the current page has any other matching criteria, and if so we push the result into the multi dimensional array called Space[].
This last push tho, it is related to the call we did when doing one of the else on wikiText() meaning we didn't find space so we launch countryPage(); to find it.
But the relations don't happen, they get pushed but not in the correct order nor the correct number of items as per the first part above of this question. It is driving me nuts for 2 days tbh.