JavaScript - confirm function

3 points
Created by:
Dirask Admin - Marvin

This article will show you how to use the confirm functions in JavaScript to display some message where the user is asked for operation confirmation.

The confirm() method displays a built-in dialog box with a message, OK, and a Cancel button.

built-in confirm dialog box with - JavaScript


const booleanResult = confirm(questionString);


Practical example

// ONLINE-RUNNER:browser;

const deleteConfirmation = confirm('Are you sure you want to delete it?');
console.log(deleteConfirmation); // true / false as boolean

JavaScript tutorial

Native Advertising
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂