how to generate random string in javascript
function getRandomString(length) {
var randomChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var result = '';
for ( var i = 0; i < length; i++ ) {
result += randomChars.charAt(Math.floor(Math.random() * randomChars.length));
}
return result;
}
//usage: getRandomString(20); // pass desired length of random stringfunction makeid() {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < 5; i++)
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
console.log(makeid());
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);Math.random().toString(36).substr(2, 5);
Also in JavaScript:
- Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/json: dial unix /var/run/docker.sock: connect: permission denied
- detect if user is online react
- getusermedia example
- js date enlever jour
- npm err! 503 service unavailable proxy
- jquery get all select options
- new features of angular 11
- pagination.js
- flatlist footer react native
- jquery loop through each child element
- pug to html
- angularjs class directive prepend
- react-native-screens
- nodemailer
- get latlong of address in here map api javascript
- settimeout in loop javascript
- led brightness website nodemcu
- open new window chrome extension
- variable javascript
- jquery add element to array
- Consider using '--resolveJsonModule
- how to create multiple folders at once in node js
- jquery get selected option value
- axios js and react