Faça identificação de determinado comprimento 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;
}
Parotay