var?randomCode?=?function?(len,dict)?{
for?(var?i?=?0,rs?=?'';?i?<?len;?i++)
rs?+=?dict.charAt(Math.floor(Math.random()?*?100000000)?%?dict.length);
return?rs;
};
//?生成隨機手機號碼
var?randomPhoneNumber?=?function(){
//?第1位是1?第2,3位是3458?第4-7位是*?最後四位隨機
return?[1,randomCode(2,'3458'),'****',randomCode(4,'0123456789')].join('');
};
console.log(randomPhoneNumber());