Skip to Content
🎲 欢迎使用 RandBox - 功能强大的 JavaScript 随机数据生成库! 了解详情

phone

// 用法 randBox.phone() randBox.phone({ formatted: false }) randBox.phone({ country: "fr" }) randBox.phone({ country: "fr", mobile: true })

生成一个随机电话号码

randBox.phone(); => '(494) 927-2152'

默认情况下,符合 NANP  标准以生成正确的美国电话号码。

可选择禁用格式化。

randBox.phone({ formatted: false }); => '2617613391'

可选择指定国家。

randBox.phone({ country: 'fr' }); => '01 60 44 92 67'

注意,目前我们只支持 'us''uk''fr' 这些国家。

对于 ukfr,可选择指定移动电话。

randBox.phone({ country: 'uk', mobile: true }); => '07624 321221'

对于 us,可选择指定 exampleNumber 以获取 ‘555’ 区号。

randBox.phone({ country: 'us', exampleNumber: true }); => '(555) 927-2152'
最后更新于: