I need a function that returns true/false if the array contains specific element or not. There are some functions such:
arr.includes(element)
that is not support IE 11.
arr.some(el => el === element)
arr.filter(el => el === element)[0]
that are supported IE 11.
But what are the best solution? Is there any more efficient way for instance by using binary search? Or any of those work with approximately perfect efficient? Any little contribution for efficient with wider browser support is attractive.
I think the best way for IE 11 :
function include(arr,obj) {
return (arr.indexOf(obj) != -1);
}