Created
November 3, 2013 15:20
-
-
Save zzuhan/7291368 to your computer and use it in GitHub Desktop.
create unique cid learn from underscore.js
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 uniqueId = function () { | |
var idCounter = 0; | |
return function(prefix){ | |
var id = ++idCounter + ''; | |
return prefix ? prefix + id : id; | |
} | |
}(); | |
var cid = uniqueId(); // 1 | |
var maskCid = uniqueId('mask') //mask2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment