“node generator string acak js” Kode Jawaban

Fungsi JavaScript menghasilkan string acak

//Create a function that returns a string, of a given length
const genRand = (len) => {
  return Math.random().toString(36).substring(2,len+2);
}

console.log(genRand(8));
//Expected output example: 4yg020wn
Lord Geir Andersen

string acak JS

function randomString(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;
	 }
randomString(4);
Dizzy Dove

JavaScript menghasilkan string acak

// program to generate random strings

const result = Math.random().toString(36).substring(2,7);
console.log(result);
Code_Breaker

menghasilkan string acak dalam javascript

function makeid(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(makeid(5));
|_Genos_|

node generator string acak js

function makeid(length) {
    var result           = [];
    var characters       = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
    var charactersLength = characters.length;
    for ( var i = 0; i < length; i++ ) {
      result.push(characters.charAt(Math.floor(Math.random() * 
 charactersLength)));
   }
   return result.join('');
}

console.log(makeid(5));
Calm Crocodile

string acak js

const string_length = 10
[...Array(string_length)].map(i=>(~~(Math.random()*36)).toString(36)).join('')
johannb75

Jawaban yang mirip dengan “node generator string acak js”

Pertanyaan yang mirip dengan “node generator string acak js”

Lebih banyak jawaban terkait untuk “node generator string acak js” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya