Answers for "make id of certain length js"

0

make id of certain length js

function makeID (length) { //Generates an id of <length> that never starts with 0
  	length --; 
	const id = parseInt(Math.floor(Math.random() * (9 - 1) + 1) + "" + Math.floor(Math.random() * 10 ** length)); 
  	return id;
}
Posted by: Guest on July-20-2021

Code answers related to "make id of certain length js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language