Hello everyone, I am back with a new article on how you can use window.confirm()
Browser API in JavaScript.
window.confirm()
let you to ask confirmation before performing a important action; for example: deleting something or posting something
Let's look it by an example:
const warn = confirm('You are going to delete this post, are you sure?')
This will show you a confirmation message.
Now, how you can check whether user has confirmed or not?
const warn = confirm('You are going to delete this post, are you sure?')
if(warn){
console.log('User has confirmed')
}
Top comments (0)