Cool idea, but kind of ironic that the example you used produces unnecessarily complicated stack overflow solutions. A JavaScript "contains" function is as simple as:
var contains = function (needle, haystack) { return haystack.indexOf(needle) !== -1 }