I have two multidimensional arrays. The first contains a lot of data, such as:
var dataarray = [ ["AX005A", "Dust / Gas", "1D / 2G", "21", "Ex II 3D IP67"],
["AX007A", "Dust / Gas", "3D / 3G", "22 / 2", "Ex II 3D T60"],
["AX008A", "Dust / Gas", "3D / 3G", "21", "Ex II 3D T60"],
["AX014A", "Dust", "3D", "22", "Ex II 3D T60"],
["AY042A", "Dust", "3D", "20", "Ex II 3D IP65 T65"],
["AY046A", "Dust", "3D", "21", "Ex II 3D T65"]];
The second stores the search queries as follows:
var searchterms = [["1","Dust / Gas"],["3","21"]];
Now I want the results array to contain only data in which the dataarray matches both search engines each at the correct index given by seachterms [n] [0]
For the seachterms parameters above, the result will look like this:
resultarray = [["AX005A", "Dust / Gas", "1D / 2G", "21", "Ex II 3D IP67"],
["AX008A", "Dust / Gas", "3D / 3G", "21", "Ex II 3D T60"]];
Since the number of search engines is not always the same, it should be a general solution that works with 2 search engines, as well as with 4 or 5 search engines.
I tried nested "for loops" with different if conditions, but at some point I got lost :(
, - .
, , - jQuery ( )