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
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
+ 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
0
Thanks for helping me .
0
Now I understand why it keeps on giving the prompt but if so how do you put a condition on it?