function find_csa(arr, subarr, from_index) { var i = from_index >>> 0, sl = subarr.length, l = arr.length + 1 - sl; loop: for (; i<l; i++) { for (var j=0; j<sl; j++) if (arr[i+j] !== subarr[j]) continue loop; return i; } return -1; }
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