📜  获取随机数 javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:27.785000             🧑  作者: Mango

代码示例3
const randomVCC = () => {
    const cc = 4728398706189983
    const randomVirtualCreditCard = Math.random(cc).toString().replace('0.', '')
    const visaCreditCard = 4 + randomVirtualCreditCard
    const pattern = /\d{16}/.exec(+visaCreditCard).join('')
    return typeof +pattern === 'number' && +pattern
}
console.log(randomVCC())