Implementation of some common data structures in JavaScript