Skip to content

Instantly share code, notes, and snippets.

@erubboli
Created December 7, 2010 15:43
Show Gist options
  • Save erubboli/731923 to your computer and use it in GitHub Desktop.
Save erubboli/731923 to your computer and use it in GitHub Desktop.
<script>
function A() {
alert("new A called");
this.my_method = function(element) {
alert("a#method called");
}
};
A.initialize = function() {
alert ("A#initialize called");
return function() {
alert ("A#initialize returned obj called");
};
}
a=new A(); /* new A called */
a.my_method() /* => a#method called*/
obj=A.initialize(); /* => A#initialize called*/
obj(); /* => A#initialize returned obj called*/
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment