Languages
[Edit]
EN

JavaScript - confirm function

3 points
Created by:
Jacob
532

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

Syntax

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
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

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.

❤️💻 🙂

Join