// includes() polyfill for strings 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; } }; } // includes() polyfill for arrays if (!Array.prototype.includes) { Object.defineProperty(Array.prototype, "includes", { enumerable: false, value: function(obj) { var newArr = this.filter(function(el) { return el == obj; }); return newArr.length > 0; } }); }