Javascript Array includes(target)
Array.prototype.includes = function (target) { var result = false this.forEach(function (el) { if (el == target) { result = true/* www. j a va2 s .c o m*/ } }); return result; }
"use strict";//from w w w. ja va 2 s . c om Array.prototype.includes = function(target) { for(var i in this) { if(this[i] === target) { return true; }; }; return false; };