Quantcast
Viewing latest article 45
Browse Latest Browse All 66

Answer by Tiago Bértolo for How do I check if an array includes a value in JavaScript?

The fastest method in Javascript to find if an array contains a value is this:

function existsInArrayForIgnoreDataType(arr, targetElem) {  for (let i = 0; i < arr.length; i++) {    if (arr[i] == targetElem) return true  }  return false }

You can find the complete study I did here.


Viewing latest article 45
Browse Latest Browse All 66

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>