You are viewing a single comment's thread. Return to all comments →
Typescript
function minimumNumber(n: number, password: string): number { let result = 0; const numbers = '0123456789'; const lowerCase = 'abcdefghijklmnopqrstuvwxyz'; const upperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; const specialCharacters = '!@#$%^&*()-+'; let noNumber = 1; let noLowercase = 1; let noUpperCase = 1; let noSpecialCharacters = 1; for (let char of password) { if (numbers.includes(char)) noNumber = 0; if (lowerCase.includes(char)) noLowercase = 0; if (upperCase.includes(char)) noUpperCase = 0; if (specialCharacters.includes(char)) noSpecialCharacters = 0; } result = noNumber + noLowercase + noUpperCase + noSpecialCharacters; return Math.max(result, 6 - n); }
Seems like cookies are disabled on this browser, please enable them to open this website
Strong Password
You are viewing a single comment's thread. Return to all comments →
Typescript