Skip to content

Instantly share code, notes, and snippets.

@Regis011
Created September 29, 2020 08:14
Show Gist options
  • Select an option

  • Save Regis011/d2a607f365367ba77d50aaab5283c3b3 to your computer and use it in GitHub Desktop.

Select an option

Save Regis011/d2a607f365367ba77d50aaab5283c3b3 to your computer and use it in GitHub Desktop.
This is javascript code maker for unique kay or id for your app
codeMaker(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~';
var charactersLength = characters.length;
for ( var i = 0; i < length; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
console.log(codeMaker(128));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment