#JavaScript Const variable inside of a Function

10 messages · Page 1 of 1 (latest)

idle furnace
#

Pretty self-explanatory but my brain is turning into mush trying to google the answer.

Trying to put the randomized letters and symbols inside of the function so it shows up when I hit 'Generate Password'

I'm sure the answer is right in front of me but I just can't find it.. Here is the scrim:

https://scrimba.com/learn/frontend/solo-project-pro-password-generator-cR9B46Sg

Scrimba

Learn to code with interactive scrims. Our courses and tutorials will teach you React, Vue, Angular, JavaScript, HTML, CSS, and more. Scrimba is the fun and easy way to learn web development.

rotund zinc
#

I think the scrim that you shared is the lesson scrim, so it may be difficult to understand exactly what you're asking. Do you have a scrim of your own that you can share that illustrates the issue?

idle furnace
#

I thought it carried over my note in the lesson?

near radish
#

Hey! Yeah that works 😄 So not much in that scrim to work with and isn't quite clear what you are asking. At the moment, you have an array filled with all of your possible characters and an empty function. Are you asking what the first step might be to turning this into a password generator?

idle furnace
rotund zinc
#

Ok, so you might not think so, but you have to tools to do this. 1) You need to do something 15 times, so what programming mechanic do you normally use when you need to do something n number of times? 2) You need to pick a random selection from a group of things, so what mechanic can you use to do this? Hint: think back to the BlackJack game module.

near radish
#

I guess that’s a hard question to answer without just repeating the content in the lesson itself. I guess the most helpful thing I could explain is how to work out what to do.

With these challenges, you need to break down what you want to achieve into steps. Some like to do something called pseudo code, basically writing out in plain English what they want the computer to do. Seems like Michael has already given a tip on this.

It’s been a while since I looked at any lessons on Scrimba so I’m guessing the content and Michael said it was a 15 character thing so let’s go for that.

Think what steps you might need to go through to get the result you want, and what JavaScript tricks you’ve learnt so far (Michael has given some hints) will help.

#

If you’re still stuck then someone might be able to help by writing out the steps to give you a starting point