Some data structure practice in JS