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
Code Example
PREVIEW READY
Loading Editor...
Live Preview

🧠 Test Your Knowledge

2 Questions

Progress: 0 / 2
Keep Going!JS - Prompt Boxes