Skip to Content
๐ŸŽฒ Welcome to RandBox - Powerful JavaScript Random Data Generation Library! Learn More

phone

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

Generate a random phone

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

By default conforms to NANPย  for a proper US phone number.

Optionally disable formatting.

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

Optionally specify a country.

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

Note, at current we only have support for 'us', 'uk', or 'fr' for countries.

For uk and fr, optionally specify a mobile phone.

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

For us, optionally specify an exampleNumber for a โ€˜555โ€™ area code.

randBox.phone({ country: 'us', exampleNumber: true }); => '(555) 927-2152'
Last updated on: