I am but new in JQuery, is there any mechanism to find out if one array element exists in another array. Like we do in linq in C#. I don't want to use for loop and if else
I am plotting a Highchart Graph in Jquery
I have 2 arrays
First 2D array contain data as X,Y cordinates like
2DArray =[2.0,6.31]
[3.0,6.09]
[4.0,7.44]
Another Array contain X Axis data like [1.0],[2.0],[3.0],[4.0]
2DArray first element is [2.0,6.31], but in the graph it starts from [1.0] point of X axis. I need if X axis point contains in 2DArray, only then Data passes in Graph.
This is what I have tried
for (var i = 0; i < 2DArray.length; i++) {
for (var x = 0; x < 1stArray.length; x++) {
if (1stArray[x] == 2DArray[i][0]) {
chart.addSeries({
name: "XX",
data: 2DArray
}, false);
}
}
}
}
But it is not working ...
I find out there is contains method, but I am not sure how to actually use it. Any suggestion will be helpful