I need help... | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 2

I need help...

This only runs through half of the script, what could the problem be? Can anyone give me a working copy? My Code: <script> function Login() { var _user = prompt("Enter Your Username"); _user = parseInt(_user); switch (_user) { case Person1: Pass(); break; case Person2: Pass(); break; default: alert("No Such User Exists"); } } function Pass() { var _pass = prompt("Enter Your Password"); _pass = parseInt(_pass); switch (_pass) { case 12345: success(); break; case 54321: success() break; default: alert("Password Was Incorrect"); } } </script> <body> <button onclick="Login()">Login</button> </body>

10th Jul 2017, 2:29 AM
❮вαιι–кιηgz❯ dario
❮вαιι–кιηgz❯ dario - avatar
4 Antworten
+ 4
Person1 and Person2 is not defined. Since you have _user = parseInt(_user); I think the case statements should use integer values (like the cases in your Pass() function.
10th Jul 2017, 3:33 AM
Bàng Tứ Cường
Bàng Tứ Cường - avatar
+ 4
Also, success() is not defined. There's no function called that! Perhaps create one.
10th Jul 2017, 3:34 AM
Rrestoring faith
Rrestoring faith - avatar
+ 4
Its just a couple minor bug fixes besides that
10th Jul 2017, 3:38 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar