Check out example codes for "javascript prompt". It will help you in understanding the concepts better.

Code Example 1

var person = prompt("Please enter your name", "Harry Potter");

if (person != null) {
  document.getElementById("demo").innerHTML =
  "Hello " + person + "! How are you today?";
}

Code Example 2

var answer = prompt('What is your name?','Joe Blogg');

Code Example 3

var proceed = confirm("Are you sure you want to proceed?");
if (proceed) {
  //proceed
} else {
  //don't proceed
}

Code Example 4

<a href="https://www.joinhoney.com/ref/4gtpzsq">https://www.joinhoney.com/ref/4gtpzsq</a>

Code Example 5

Copyvar name = window.prompt("Enter your name: ");
alert("Your name is " + name);

Learn ReactJs, React Native from akashmittal.com