News for hackers. Stuff that matters.
Re:Why Code Snobs Are Invaluable by Kiro on Thursday February 26, 2015 @02:02PM (#9114517)
OT but when do you need singletons in JavaScript?
Re:Why Code Snobs Are Invaluable by ceslami on Thursday February 26, 2015 @09:37PM (#9116877)
Pretty much the same as in any other language. When you want to guarantee that there will only ever be one instance of an object.

It is a useful pattern for managing data synchronization (ie, if I only ever have one instance of a User, I know another instance won't mess up its state accidentally.)