Nearby lessons

25 of 40

✅ JavaScript confirm()

📌 What is JavaScript confirm()?

The confirm() method shows a dialog box with OK and Cancel buttons.

Used to ask user confirmation before performing an action.

📋 confirm() Basics

AttributeDescription
Syntaxconfirm(message)
Returntrue (if OK) / false (if Cancel)
Use CaseDelete confirmation, exit prompt
Example02
Code Cell
Loading Editor...
✏️ You can edit this code — click Run to refresh the preview.
Output

🧠 Test Your Knowledge

2 Questions
Progress: 0 / 2