function isArrayInArray(arr, item){ var item_as_string = JSON.stringify(item); var contains = arr.some(function(ele){ return JSON.stringify(ele) === item_as_string; }); return contains; } var myArray = [ [1, 0], [1, 1], [1, 3], [2, 4] ] var item = [1, 0] console.log(isArrayInArray(myArray, item)); // Print true if found
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter