Advertisement
Zakkster

Untitled

Feb 12th, 2025
78
0
21 hours
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Authenticate a list of usernames
  3.  *
  4.  * Given an array of strings representing a list of usernames, return true only if all usernames comply with your
  5.  * company's guidelines. Return false otherwise.
  6.  *
  7.  * it is between 6-10 characters long;
  8.  * contains at least 1 lowercase letter;
  9.  * contains at least 1 number;
  10.  * contains only numbers and lowercase letters.
  11.  */
  12.  
  13. function authList(arr) {
  14.     return arr.every(v => /^(?=.*[a-z])(?=.*\d)[a-z\d]{6,10}$/.test(v)); //every, positive, negati look ahead, negation
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement