Dealing with a JavaScript array can be so challenging, especially when it comes to searching for an index. In my case, I have an array that contains objects, and each object has an array as one of its values.
This is the snippet of my source code:
rows = [{"id":"id0","cell":["array1","array2"]},{"id":"id1","cell":["array3","array4"]}];
I attempted the following:
var v = {cell:["array1","array2"]};
rows.indexOf(v)
In addition, there is a radio button:
<input type="radio" name='array' value="array1, array2">
Here's how jQuery plays into this scenario:
var i = $("input:checked").val().split(',');
rows.indexOf(i)
Unfortunately, the result of the index turns out to be -1.