Created
October 18, 2013 09:37
-
-
Save simondell/7039095 to your computer and use it in GitHub Desktop.
An example "class", or a "type", or a "module". The example was created to highlight "private static functions", and their placement in the file. General JS community dialog favours highlighting the effect of variable and function "hoisting" by writing such object definitions at the top of their scope. For larger objects intended as classes or m…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MyStructure = (function () { | |
return { | |
str: 'rush', | |
go: function () { | |
doThisFirst(); | |
doThisNext( this ); | |
return this; | |
} | |
} | |
function doThisFirst () { | |
console.log( 'first' ); | |
} | |
function doThisNext ( obj ) { | |
console.log( 'oh wow second ' + obj.str ); | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment