An alert box is used when you want to ensure that information gets through to the user. The alert function takes a single parameter, which is the text displayed in the popup box. When an alert box pops up, the user must click OK to proceed.
Syntax of the alert box:-
A prompt box is often used to have the user input a value before entering a page. When the box opens, the user sees two buttons i,e OK or Cancel. If the user clicks OK, the box returns the input value. If the user clicks Cancel, the box returns null. It has two parameters. These are:-
The first is the label, which is displayed in the text box.
The second is the default string to display in the text box. This parameter is optional.
Syntax of prompt Box:-
A confirm box is often used to have the user verify or accept something. When a confirm box pops up, the user must click either OK or Cancel to proceed. If the user clicks OK, the box returns true. If the user clicks Cancel, the box returns false.
confirm("Your confirmation message");