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