Editing JavaScript/Notes/Singleton
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 5: | Line 5: | ||
== Lazy Initialization == | == Lazy Initialization == | ||
This example of a Singleton uses my patented "function rewriting" technique, where `getAnObject` | This example of a Singleton uses my patented "function rewriting" technique, where `getAnObject` is reassigned to the nested function inside the first call. | ||
<source lang="javascript"> | <source lang="javascript"> | ||
function getAnObject(a) { | function getAnObject(a) { |