Skip to content

Instantly share code, notes, and snippets.

@rmrotek
Created September 17, 2018 20:40
Show Gist options
  • Select an option

  • Save rmrotek/a6d2eeb57a907a8c680b30495ccc9e01 to your computer and use it in GitHub Desktop.

Select an option

Save rmrotek/a6d2eeb57a907a8c680b30495ccc9e01 to your computer and use it in GitHub Desktop.
PIN validation
function validatePIN(pin) {
if (pin.match(/^\d{4}$|^\d{6}$/) && (pin.length == 4 || pin.length == 6)){
return true;
}
else {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment