▲ Hack for solving needle in haystack problems when the haystack is an array at medium.com▼1 up and 1 down, posted by tanyagupta 2914 days ago 1 comment
jklu 2914 days ago. link 1 point ▲ ▼Just for reference, jsperf tests a number of variants: http://jsperf.com/array-indexof-vs-object-s-in-operator/4 Fastest method being: if (typeof obj['that'] !== "undefined") { // found } For very large datasets one could also look at bloom filters, e.g: https://www.jasondavies.com/bloomfilter/