Differentiate between alert and prompt dialog box giving suitable example.
SOLUTION....
Feature | Alert | Prompt |
---|---|---|
Purpose | Used to display a message to the user | Used to take input from the user |
User Input | Does not take input (only shows “OK” button) | Accepts user input through a text field |
Return Value | Returns undefined (nothing to capture) |
Returns the text entered by the user, or null if cancelled |
Buttons | Has only OK button | Has OK and Cancel buttons |
Use Case | Showing warnings, notifications, information | Asking user for input, like name or age |

