I created a Password generator but I am getting a issue.before password undefine is written. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I created a Password generator but I am getting a issue.before password undefine is written.

https://sololearn.com/compiler-playground/WD6JD1cNEUz0/?ref=app

19th Mar 2024, 12:22 PM
Raj Singh
Raj Singh - avatar
3 Answers
+ 2
Hi Raj Singh The 'password' variable is initially 'undefined' by default that's the reason 'undefined' is getting concatenated at the beginning of the generated password.To fix this, you can intialize 'password' variable to empty string like below. let password="";
19th Mar 2024, 12:45 PM
𝘕𝘉
𝘕𝘉 - avatar
+ 1
Thanks NB for help. have a great day.
19th Mar 2024, 2:41 PM
Raj Singh
Raj Singh - avatar
0
Welcome 👍
19th Mar 2024, 2:49 PM
𝘕𝘉
𝘕𝘉 - avatar