Nearby lessons

23 of 40

📦 JavaScript Dialog Boxes

📌 What are JavaScript Dialog Boxes?

JavaScript provides built-in dialog boxes to interact with users.

These boxes are modal, meaning they pause script execution until the user responds.

📋 What is a Box?

AttributeDescription
DefinitionIn JavaScript, a box refers to a pop-up dialog used to display messages or get user input.
BehaviorAll boxes are modal and prevent further interaction with the page until closed.

📦 Types of Boxes

AttributeDescription
alert()Displays a message with an OK button. Used for notifications.
confirm()Asks a yes/no question with OK and Cancel buttons. Returns true or false.
prompt()Prompts the user for input with a text field. Returns the input or null.

🧠 Test Your Knowledge

3 Questions

Progress: 0 / 3
Keep Going!JS - Alert Box