Message from JavaScript discussions

June 2017

— I tend to use Factory and singleton together, so I can initialize the Factory in a closure and then expose it

Message permanent page


JS has a unique use for singletons imo, or rather IIFE in general, due to how scope is handled. You can use an IIFE much like a class and have all the encapsulation benefits, but like a Factory you can choose to expose specific things via the revealing module pattern. If anything JS IIFE are an efficient way to partition modules of your application from each other

— I use static methods inside an IIFE and expose an interface to them, rather than treat it like a class

Message permanent page

— I also tend to like factories way more

— Hi everybody

— Can someone help to forwarding port in nodejs

— You port forward in your router settings

— Has nothing to do with node

— Useful for js

— I mean my response should go to port 5000 while i use port 3000

— So open your default gateway in your browser, log in, forward port 3000 to external port 5000

— Thanks a lot will try now