(Math.floor(Math.random() * 90000) + 10000).toString(); code example
Example: create random 4 digit number js
var val = Math.floor(1000 + Math.random() * 9000);
console.log(val);
var val = Math.floor(1000 + Math.random() * 9000);
console.log(val);