The following code shows an example of Taking Input Using Prompt() in JavaScript.

<html>
 <head>
   <title>Date Object</title>
   <script>
    var myname=prompt("Enter your name: ");
    document.write("Welcome "+myname);
   </script>
   <style>
     body{
        color: #992288;
        background: #ffddff;
	font-size: 20px;
     }
   </style>
 </head>
 <body>
 
 </body>
</html>

Output

Example of prompt() Function in JavaScript
Example of prompt() Function in JavaScript