Using objects as hashtables in Javascript