This script will be useful for those who wants a unique ID in String.
Run this script by calling to function from html:- makeid(8)
<script>
function makeid(l) { var text = ""; var char_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for(var i=0; i < l; i++ ) { text += char_list.charAt(Math.floor(Math.random() * char_list.length)); } return text; }
console.log(makeid(8)); //check in console 8 character unique id will generate.
</script>
Run this script by calling to function from html:- makeid(8)
<script>
function makeid(l) { var text = ""; var char_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for(var i=0; i < l; i++ ) { text += char_list.charAt(Math.floor(Math.random() * char_list.length)); } return text; }
console.log(makeid(8)); //check in console 8 character unique id will generate.
</script>
0 comments:
Post a Comment