Alert()- it is a pop up that is intended for the user to click the OK button and vanish once you click.

Confirm ()- it is a wider choice and gives 2 options to the user to choose. It is basically like an if-else statement.

BY Best Interview Question ON 07 Jul 2019


Display message with alert() and confirm()

alert('Are you sure to delete this item?');
confirm("Are you sure to delete this item?");