Actualmente estoy tratando de crear un creador de contraseñas, solo para practicar. Sin embargo, me he encontrado con un problema. Cuando intento consolar. registrar mi contraseña, genera mensajes de error indefinidos. Creo que tiene algo que ver con mi ciclo for en mi función generatePassword, sin embargo, yo mismo no veo el problema.
JavaScript
const randomFunc = { lower: getRandomLower, upper: getRandomUpper, number: getRandomNumber, symbol: getRandomSymbol } const passwLength = 20; function generatePassword() { for(let i = 0; i < passwLength;) { let password = randomFunc.lower; randomFunc.upper; randomFunc.number; randomFunc.symbol; i++ console.log(password) } } function getRandomLower() { return String.fromCharCode(Math.floor(Math.random() * 26) + 97); } function getRandomUpper() { return String.fromCharCode(Math.floor(Math.random() * 26) + 65); } function getRandomNumber() { return String.fromCharCode(Math.floor(Math.random() * 10) + 48); } function getRandomSymbol() { const symbols = '!"#¤%&/()=@£$€{[]}|*^~+-,.;:<>|§'; return symbols[Math.floor(Math.random() * symbols.length)]; }