How do you use confirm?



I'm at tutorial and it's asking me to use confirm. For example use confirm in a sentence:

confirm("I am feeling awesome");

but this doesn't go through.

How do I use confirm?


confirm("I am feeling awesome");

When you run this code, You will get something like this-

A tiny little box popped up on top of page with Ok / Cancel button.

When you click OK -- It returns true boolean value
When you click Cancel -- It returns false booleans value

You can even save the boolean value inside the variable by doing this--

var response = confirm("I am feeling awesome");
response is variable.

Now if someone clicks Ok , true will be stored in response
or if someone clicks Cancel then false will be stored in response



Thank you so much dear!



Youre welcome! :slight_smile: Keep up the good work! :thumbsup:



Thanks alot!!

Best wishes!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.