javascript - Check if the value in array in efficiently -


this question has answer here:

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

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -