Created
September 24, 2014 13:57
-
-
Save satbirdd/0e1f34e9fb43f92d2534 to your computer and use it in GitHub Desktop.
generate id for javascript class
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
function A () { | |
this.generateId(); | |
} | |
A.prototype.generateId = (function () { | |
var count = 0; | |
return function () { | |
count ++; | |
this.id = count; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment