Array.prototype.subset

It’s for finding subsets in an array. Can anyone find fault in this?

Array.prototype.subset = function(b)
{
	if(b.length > this.length)
		return false; // Needle is longer than haystack

	var s = this.indexOf(b[0]);	

	if(s >= 0)
	{
		for(var i = 0; i < b.length; i++)
		{
			if(this[(i + s)] == b[i])
				continue;
			else return false;
		}
		return true;
	} else return false;
}

Comments Closed