If you have both these questions then you should read this article till the end. Here I will explain to you about this topic with an example.
- Confirm box has two buttons where first one is “OK” and second one is “cancel”.
- Here the browser needs some confirmation from the user.
- When a confirm box popup, the user will have to click either “OK” or “Cancel” to proceed.
- If the user clicks “OK”, the box returns true. If the user clicks “Cancel”, the box returns false.
You should also read these articles.