I am considering using JavaScript object as a dictionary.
var dict = {}
dict['a'] = 1;
dict['b'] = 2;
var my_first = dict['a'];
I am not clear about the time-complexity of such implementation. Is it like hashing?
Thank you.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
JavaScript objects are often called “hashes” (mostly by recovering Perl addicts) or “hash tables” (unrepentant Java people). The typical look-up is somewhere between O(1) and O(log n).