Uhm, There is something wrote in my JavaScript. I did not learn much on JavaScript. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Uhm, There is something wrote in my JavaScript. I did not learn much on JavaScript.

alert('To the Given imformation of Apple & Android Users Answer the following Questions.'); var username = prompt("Apple id & Account"); confirm (username); else if { var username = alert("Uhm, There was a typo..") }

11th Aug 2022, 9:40 AM
11B57
11B57 - avatar
9 Answers
+ 6
Because you are taking user input and what ? Confirming ? See below it is some changes Specifically I didn't actually understand how you used else if Means do you wanted to match the username input with other pre defined username equal or not? 👇🏻 alert('To the Given information of Apple & Android Users Answer the following Questions.'); var username = prompt('Apple id & Account'); var word = confirm(username); if(word == true) { alert("Welcome " + username); } else { alert("Uhm, There was a typo.."); }
11th Aug 2022, 9:58 AM
Suparna Das
Suparna Das - avatar
+ 7
isaiah Armstrong but Your code is just confirming yes or no (means either ok or cancel) and no user input But Lost Campain even wanted to take id value from the user So you can use prompt() for that
13th Aug 2022, 6:36 AM
Suparna Das
Suparna Das - avatar
+ 6
Do you wanted to create pre defined username value and wanted to check whether it's equal or not with the user input ??? there is typo in "information"
11th Aug 2022, 10:03 AM
Suparna Das
Suparna Das - avatar
+ 6
Lost Campain its my pleasure to help you 🙂🙂🙂
11th Aug 2022, 10:46 AM
Suparna Das
Suparna Das - avatar
+ 2
i think ot should be like this: alert("to answer given questions ...") var username = confirm("apple id & account") if(username === true){ alert("correct") }else if(username === false){ alert("err") }
13th Aug 2022, 12:25 AM
isaiah Armstrong
+ 1
Okay, thank you very much Suparna!
11th Aug 2022, 10:45 AM
11B57
11B57 - avatar
+ 1
Have a great day Suparna
11th Aug 2022, 10:47 AM
11B57
11B57 - avatar
+ 1
May i ask suparna? What if user skipped the test, is it possible to change?
11th Aug 2022, 10:49 AM
11B57
11B57 - avatar
+ 1
isaiah Armstrong it's easier on Suparna and more valued + easier to understand, but thank you still!
13th Aug 2022, 12:35 AM
11B57
11B57 - avatar