Implementation of various data structures using Javascript