Guest User

Untitled

a guest
Jul 25th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. validatePIN("1234") === true
  2. validatePIN("12345") === false
  3. validatePIN("a234") === false
  4.  
  5. function validatePIN (pin) {
  6. //return true or false
  7. if (pin.length == 4) {
  8. return true;
  9. } else if (pin.length == 6) {
  10. return true;
  11. }
  12.  
  13. return false;
  14.  
  15. }
  16.  
  17. ^(d{4}|d{6})$
Add Comment
Please, Sign In to add comment