Aim / उद्देश्य

Ask for the user's name and show a confirmation before a simulated delete. / User का नाम पूछना और demo delete से पहले confirmation लेना।

This is only a demonstration. It does not delete a real record. / यह केवल demo है; इससे कोई वास्तविक record delete नहीं होता।

Click the button to begin. / शुरू करने के लिए button दबाएँ।

Program / प्रोग्राम

const name = prompt("Enter your name");
if (name === null) {
  // The user cancelled the prompt.
} else if (confirm("Do you want to delete the record?")) {
  // Simulated delete confirmed.
} else {
  // Simulated delete cancelled.
}

Correction / सुधार: Instead of using document.write() to display the name, write to an existing page element using textContent.

← All additional practicals