Skip to content

Instantly share code, notes, and snippets.

@marzk
marzk / gist:730957b8da1e4107c5ef
Created June 11, 2015 05:11
lengthOfSequence
function lengthOfSequence(arr, x) {
arr.unshift(' '); arr.push(' ');
var rel = arr.join(' ').split(' ' + x + ' ');
if (rel.length !== 3) return 0;
return rel[1].split(' ').length + 2;
}