javascript - Check if the value in array in efficiently -
this question has answer here:
- how javascript hash map implemented? 5 answers
- how associative array/hashing in javascript 9 answers
my goal find if value in javascript array, efficiently. understand inarray? check execute in o(n) n length of array because have traverse through every variable in array. hashmap return value in 0(1) (at least understanding)
so if instead of traversing array created key -> variable association, key identical value , tried getting element key. if exists, return true, if 'undefined', return false?
has ever done before , feasible in terms of javascript language?
Comments
Post a Comment