Ask coding questions

← Back to all posts
How to you alert something in only javascript that has a 2 choices: Ok, or Cancel?
h
okalisl

I have been working on javascript by itself without html and have been trying to make an alert with 2 choices: Ok, or Cancel. But it has not been working. Anyone know how to do this without html?

Answered by AmoghTheCool [earned 5 cycles]
View Answer
Voters
okalisl
Comments
hotnewtop
AmoghTheCool

@okalisl you should use the confirm function - pass in the question. It returns a boolean:

If you are in a HTML, CSS, JS repl then that should work - but as far as I know this cannot be done in node.js.

okalisl

Thank you so much for the help @AmoghTheCool!!!

AmoghTheCool

@okalisl welcome!