poserposer13 / Password-Generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Random Password Generator

This is a random password generator. It takes a length given by the user. It will ask for whether or not the user wants uppercase, lowercase, numbers, or special characters. Then, it will take all of those specifications and give a random password with all the specifications given.

How I Did This

I set this up first by creating the inputs the user will give. I first set up the length because I wanted to make sure it was set number before allowing the user to move on. I then set up the confirms for the user and set those with a conditional statement that will add a certain value to an empty array. This was done by creating values, each representing one of the specifications. It was then split into individual characters. Finally, it would be added, or concatenated, into an array that would be pulled from later. Once the user inputs their desired specs, the function would randomly pull the desired number of characters from the array that contained the characters that were concatenated into the array mentioned earlier. Once there were enough random characters pulled from the array, the password would be displayed in the text field.

Struggles

My initially struggles were with making sure the user couldn't pass if they didn't enter the correct amount of characters. This honestly is still an issue that I was not able to not get it to not duplicate itself if the user first gives a incorrect length. The other struggle I had was of getting the values set that the array needed to pull from. This was just a challenge cause I first tried to create an object then multiple arrays. While those could have worked, I just settled on making all of them strings, splitting them, then seeing if they were needed. The randomization was a little difficult but once I was able to create the overall array, it became clear on how to make it random and the given length.

About


Languages

Language:JavaScript 43.4%Language:CSS 39.0%Language:HTML 17.7%