Skip to content

Instantly share code, notes, and snippets.



Last active Aug 29, 2015
What would you like to do?
Javascript Member Variables done properly

javascript member variables

know the difference between shared and instance specific member variables in javascript.

// data is shared between all MyModule Instances (probably not intended to do so)
// so if one instance modifies data, all other instances share the modified data object = {super: 'clever'}
// intended member variable, that is not shared between the myModule Instances
MyModule.prototype.init = function() { = {super: 'clever'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment