Created
October 4, 2015 06:44
-
-
Save dgowrie/29b270c5545e44dc08d5 to your computer and use it in GitHub Desktop.
Yet another iteration of (revealing)Prototype Pattern with private/public methods
This file contains hidden or 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 myPrototypeModule = (function() { | |
'use strict'; | |
var privateVar = 'Alex Castrounis', | |
count = 0; | |
function PrototypeModule(name) { | |
this.name = name; | |
} | |
function privateFunction() { | |
console.log('Name:' + privateVar); | |
count++; | |
} | |
PrototypeModule.prototype.setName = function(strName) { | |
this.name = strName; | |
}; | |
PrototypeModule.prototype.getName = function() { | |
privateFunction(); | |
}; | |
return PrototypeModule; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment