Created
May 25, 2023 01:34
-
-
Save ebeloded/ecce772c1acab6f5c213e9005355c348 to your computer and use it in GitHub Desktop.
stringId
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 getStringId(index) { | |
const symbols = | |
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' | |
let num = index | |
let id = '' | |
do { | |
id = symbols[num % 62] + id | |
num = Math.floor(num / 62) | |
} while (num > 0) | |
return id | |
} | |
const x = Math.floor((Date.now() - Number(new Date(2023, 4))) / 1000) /*?*/ | |
getStringId(x) /*?*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment