How do you use confirm?


#1

Hi,

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?


#2

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


#3

Ok!

Thank you so much dear!

Best


#4

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


#5

Sure!

Thanks alot!!

Best wishes!


#6

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