JavaScript provides built-in popup boxes to communicate with users. These popup boxes can display messages, ask for confirmation, or collect user input.
JavaScript provides three built-in popup methods.
| Method | Purpose |
|---|---|
| alert() | Displays a message with an OK button. |
| confirm() | Displays OK and Cancel buttons. |
| prompt() | Takes input from the user. |
The alert() function displays information to the user.
It contains only one button: OK.
The confirm() function asks the user to confirm an action.
It displays two buttons:
It returns:
Which JavaScript function is used to get input from the user?