0

How to solve this practice

What is wrong with my code? It is from Web development course in the last module of JS - Practice Verification let pin = 2345(prompt("Enter pin")); // log "Success" to the console if user input matches 1345 if (pin = 1345) { console.log("Success"); } // log "Fail" if user input doesn't match the given pin else { console.log("Fail"); }

3rd Nov 2024, 9:13 PM
Samuel Zelíska
Samuel Zelíska - avatar
7 Réponses
+ 4
Samuel Zelíska are you trying to make pin a variable '=' in the if condition statement or trying to compare '==' 🤔 I think 🤔 you simply forgot something here var x = if x ==
3rd Nov 2024, 9:39 PM
BroFar
BroFar - avatar
+ 3
Jan yes it's the same one... A CAPTCHA is a type of challenge test used in Web pages to check that the user is a human.  The given code stores the pin that the user entered. Task   Complete the code to log Success or Fail to the console based on the results of the test. The given pin is 1345 it's just before "More on Conditions"
3rd Nov 2024, 10:51 PM
BroFar
BroFar - avatar
+ 3
BroFar I tried to uninstall and then reinstalled the app, but that task is still not available in the Web Development course. In the Introduction to JavaScript course, the task appears under the name, Verification. Maybe something messes up if SL has a reference to the same task in two different courses, so the task only appears in one course but not in another course.
4th Nov 2024, 7:20 AM
Jan
Jan - avatar
+ 2
It's a little bit weird, because I don't have that task in the Web Development course, but I have it in the Introduction to JavaScript Course, and it doesn't take any kind of inputs.
3rd Nov 2024, 10:42 PM
Jan
Jan - avatar
+ 2
Samuel Zelíska I have completed Web Development course, but for some reason, that Verification task is not available i my version of the course, but the Verification task was available when I completed the Introduction to JavaScript course, and it didn't require any external input from a prompt or anything else, so could you please share the description from the Web Development course of that Verification task so we can find out whether the Verification task takes input or not? As I mentioned, it didn't take any input in the Introduction to JavaScript course, so I think it might be the same in the Web Development course.
4th Nov 2024, 6:26 PM
Jan
Jan - avatar
+ 1
Remove the rest of the line after 2345. It should be like this.... let pin = 2345;
3rd Nov 2024, 10:03 PM
Jan
Jan - avatar
0
It shows this error message: The error occurs because `prompt` is not available in Node.js. Use a different method, like `readline`, to get user input in a Node environment. I don't know what else can I try, nothing works
4th Nov 2024, 5:01 PM
Samuel Zelíska
Samuel Zelíska - avatar