Solución
solution.tsTypeScript
function isValidPassword(password: string): boolean {
const uppercaseExp = /[A-Z]/
const digitExp = /[0-9]/
const symbolExp = /[!@#$%^&*]/
const hasUppercase = uppercaseExp.test(password);
const hasDigit = digitExp.test(password);
const hasSymbol = symbolExp.test(password);
if ( password.length < 8) return false;
if ( !hasUppercase) return false;
if ( !hasDigit) return false;
if ( !hasSymbol) return false;
return true;
}
// No modificar: necesario para evaluar el resultado.
export { isValidPassword };0respuestas