12 lines
243 B
JavaScript
12 lines
243 B
JavaScript
|
String.prototype.includes = function(search, start) {
|
||
|
'use strict';
|
||
|
if (typeof start !== 'number') {
|
||
|
start = 0;
|
||
|
}
|
||
|
|
||
|
if (start + search.length > this.length) {
|
||
|
return false;
|
||
|
} else {
|
||
|
return this.indexOf(search, start) !== -1;
|
||
|
}
|
||
|
};
|