I played with jsperf.com and found that the prototype 40x function is slower than the default declared function.
String.prototype.contains = function(s){ return !!~this.indexOf(s) }
= 220K ops / s
against.
function isContains(str, s) { return !!~str.indexOf(s) }
= 8.5KK ops / s
Here's a jsperf test case
PS I know that the modification of the prototype is not the best option and can be called the "monkey patch" :)
source share