I have been working on a project and developing a JavaScript framework. The original code is about 700 lines so I only pasted this line. The includes method doesn't work on Internet Explorer. Is there any solution for this?
var row_cells = tbl_row.match(/<td[\s\S]*?<\/td>/g);
row.Cells = new Array();
if (onRowBindFuncText != null) { /*Fonksyon tanımlanmaışsa daha hızlı çalış*/
var cellCount = 0;
for (i = 0; i < row_cells.length; i++) {
var cell = new Cell();
$.each(this, function (k, v) {
if ((row_cells[i]+"").includes("#Eval(" + k + ")")) {
cell.Keys.push(new Key(k,v));
...Code goes on
Because it's not supported in IE, it is not supported also in Opera (see the compatibility table), but you can use the suggested polyfill:
Polyfill
This method has been added to the ECMAScript 2015 specification and may not be available in all JavaScript implementations yet. However, you can easily polyfill this method:
if (!String.prototype.includes) {
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;
}
};
}