Skip to content

Instantly share code, notes, and snippets.

@trangsihung
Created October 26, 2022 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trangsihung/cf9f4ba840d5b104da56ee4421ae1f64 to your computer and use it in GitHub Desktop.
Save trangsihung/cf9f4ba840d5b104da56ee4421ae1f64 to your computer and use it in GitHub Desktop.
Check đầu số di động việt nam
function checkPhoneFormat (phone) {
var prefix = [
'086',
'096',
'097',
'098',
'032',
'033',
'034',
'035',
'036',
'037',
'038',
'039', // Viettel
'088',
'091',
'094',
'083',
'084',
'085',
'081',
'082', // VinaPhone
'089',
'090',
'093',
'070',
'079',
'077',
'076',
'078', // MobiFone
'092',
'056',
'058', // Vietnamobile
'099',
'059', // Gmobile
'087', // Itelecom
]
var phonePrefix = phone.substring(0, 3)
return prefix.includes(phonePrefix)
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment