I have a strange problem. I have a Javascript nested array and I would like to test for containment of an array in the nest:
var arr1, arr2;
arr1 = [[1, 2], [0, -1]];
arr2 = [1, 2];
if (arr1.indexOf(arr2) > -1)
alert("success!");
However, the above code returns false for the containment test. Any efficient suggestions on the fix?
Aucun commentaire:
Enregistrer un commentaire