This took me around 30 minutes to complete. I used this project to practice navigating github. Instead of random messages, I tried to make this project a bit more practical by creating a random password generator composed of different categories.
My project can be found HERE
I appreciate any feedback on this project!
Ooh another password generator! This one seems to be a popular one, same with the fortune cookie.
One thing I’m noticing is that you’ve got a bit of repetition in your code. Maybe it’s just due to you hardcoding in the length parameter of createPword, but could this section:
const createPword = (length=2,charLength) => {
const Pword = [];
for (let i = 0; i<=length-1; i++){
Pword.push(random10());
}
for (let i = 0; i<=length-1; i++){
Pword.push(lowercaseLetters[random26()]);
}
for (let i = 0; i<=length-1; i++){
Pword.push(uppercaseLetters[random26()]);
}
for (let i = 0; i<=length-1; i++){
Pword.push(animals[random10()]);
}
for (let i = 0; i<=length-1; i++){
Pword.push(lowercaseLetters[random10()]);
}
for (let i = 0; i<=length-1; i++){
Pword.push(specialChar[random10()]);
}
shuffle(Pword);
const password = Pword.join('');
console.log(`Your new random password is: ${password.slice(0,charLength)}`);
}
Be condensed to simply:
const createPword = (length=2,charLength) => {
const Pword = []
for (let i = 0; i<=length-1; i++){
Pword.push(random10());
Pword.push(lowercaseLetters[random26()]);
Pword.push(uppercaseLetters[random26()]);
Pword.push(animals[random10()]);
Pword.push(lowercaseLetters[random10()]);
Pword.push(specialChar[random10()]);
}
shuffle(Pword);
const password = Pword.join('');
console.log(`Your new random password is: ${password.slice(0,charLength)}`);
}
Although I’m not sure if this will work if you intend for length to be different for each loop in future?
Other than that - looks great! Glad to see someone else needing a proper practical to get the hang of Git. We’ll get there one day!
You’re right! Can’t believe I didn’t see that. Thanks for pointing that out; I appreciate the feedback.
1 Like