Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript function generate a random string

//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
 
PREVIOUS NEXT
Tagged: #javascript #function #generate #random #string
ADD COMMENT
Topic
Name
5+3 =