- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
- They are the people who get things done. Effective Engineers produce results.
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
| var Singleton = (function(){ | |
| var _instance; | |
| function init() { | |
| function privateMethod() {} | |
| var privateVariable = "42"; | |
| var privateRandomX = Math.random(); | |
| return { | |
| publicMethod: function() {}, | |
| publicProperty: "23", | |
| getRandomX: function() { return privateRandomX; } |