Basic implementation of data structures in JavaScript