0

Can you please tell me what is wrong with my code?

I am trying to create an optional to the user asking if he/she would like to try the code. As I click cancel why does it not stop the showing of prompts?Can you please tell me ? I am still learning and I would like to learn form you. https://code.sololearn.com/WTAL05E2V5v7/?ref=app

24th Jun 2020, 11:47 PM
Samuel Barker
Samuel Barker - avatar
4 Answers
+ 1
The code you only want to happen if ok is clicked has to go in the if block between the {}. you dont need the else block unless you specifically want something to happen if cancel is clicked
24th Jun 2020, 11:55 PM
JME
+ 1
when you cancel then variable go becomes false and if condition is false so, alert("Lets get started"); are not shown. there is no any condition on prompt that's why it executes
25th Jun 2020, 12:01 AM
Manish Kumar
Manish Kumar - avatar
0
Thanks for helping me .
25th Jun 2020, 12:00 AM
Samuel Barker
Samuel Barker - avatar
0
Now I understand why it keeps on giving the prompt but if so how do you put a condition on it?
25th Jun 2020, 12:08 AM
Samuel Barker
Samuel Barker - avatar