Define and use {Array,String}.prototype.contains.

Define Array.prototype.contains.
Replace 'contains(array, item)' with 'array.contains(item)'.
Replace 'for (i in a)' with 'for (i = 0; i < a.length; i++)'
Define String.prototype.contains.
Replace 'contains(string, char)' with 'string.contains(char)'.