Data structure implementations in javascript