Created
March 19, 2016 14:58
-
-
Save mladen/374e35a1fafb9f4b19c8 to your computer and use it in GitHub Desktop.
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
// The ID() function will return a unique number every time you call. | |
// Code is from http://qnimate.com/generate-unique-number-in-javascript/ | |
function uniqueNumber() { | |
var date = Date.now(); | |
if (date <= uniqueNumber.previous) { | |
date = ++uniqueNumber.previous; | |
} else { | |
uniqueNumber.previous = date; | |
} | |
return date; | |
} | |
uniqueNumber.previous = 0; | |
function ID(){ | |
return uniqueNumber(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment