A variable is assigned a value using the assignment operator "=". The next example shows how to prompt the user to enter information as shown here
	<!DOCTTYPE html> 
<!--Example 1: Promt.html -->
<html>
<head>
<title> Prompt the user </title>
<script >
<!--
//Display a prompt box"
var username; //this variable is used to store the user's name
name = window.prompt('Enter your name:');
document.write('<h2> Hi ' + name + ': Welcome to my JavaScript course! </h2>');
// -->
</script>
</head>
<body></body>
</html>
Here is how the message get displayed as shown here:


For more details, please contact me here.
Date of last modification: March 26, 2019.