methods created when creating new object should be in prototype chain not in object itself. Since functions/method itself an object , it memory for it , when creating a object. var que = new buckets.Queue(); que object is created , and method like enqueue and dequeue is also created in object itself , not in prototype chain. If I create a hundreds of object like this. It will take a lot of memory .