Need help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Need help

Hey guys.Today I want to create password for my website,example if you enter website,it will ask you to enter password.I know,it is not necessary,but I want go deeper parts of JavaScript. I need something that if entered password is wrong,it asks back again for correct password.I already made 70% of code,so need help for rest of 30%.Hope you will get my point.Thanks https://code.sololearn.com/WG3bmAv94Z8r/?ref=app

18th Aug 2017, 6:20 PM
Elshad Abbasov
Elshad Abbasov - avatar
9 Answers
+ 4
window.onload = function(){ var pw = prompt("please insert password"); while(pw !== "Elshad") { alert("false password try again"); pw = prompt("please insert password"); if(pw === "Elshad") { alert("Nice, Bro"); } } }
18th Aug 2017, 6:37 PM
Max_N
Max_N - avatar
+ 4
var x = prompt("Enter password:"); if(x == "yourPassword"){ alert("Accepted"); } else { alert("Try again"); } Edit: add this while (x != "yourPassword"){ prompt("Enter your Password:"); }
18th Aug 2017, 6:28 PM
Iwan
Iwan - avatar
+ 4
This is a way... Otherwise no gained access https://code.sololearn.com/Wkbf5G4EX168/?ref=app
18th Aug 2017, 6:40 PM
Iwan
Iwan - avatar
+ 3
Yes
18th Aug 2017, 6:35 PM
Iwan
Iwan - avatar
+ 3
Did you get my point?Can you make it?If someone help me with it,maybe we can lock our website :)
18th Aug 2017, 6:37 PM
Elshad Abbasov
Elshad Abbasov - avatar
+ 3
This is infinite...
18th Aug 2017, 6:38 PM
Iwan
Iwan - avatar
+ 2
Iwan look at my code,I already did it.Thanks anyway,but I need that Noone can access my website unless they enters valid password.Hope you will get my point.
18th Aug 2017, 6:35 PM
Elshad Abbasov
Elshad Abbasov - avatar
+ 2
Thanks everyone brothers!
18th Aug 2017, 6:39 PM
Elshad Abbasov
Elshad Abbasov - avatar
+ 2
Thanks @Iwan and @Max_N!I will credit both of you in my code!
18th Aug 2017, 6:43 PM
Elshad Abbasov
Elshad Abbasov - avatar