// program to take the user's name
let name = prompt("Enter your name: ");
console.log("Name: " + name);
Output
Enter your name: James
Name: James
// program to take the user's name
let name = prompt("Enter your name: "); // take input
console.log("Name: " + name); // print the name variable
Output
Enter your name: James
Name: James
// program to take user's name and age
let name = prompt("Enter a name: ");
// let age = prompt("Enter age: ");
console.log("name: " + name);
// console.log("age:", age);
Output
Enter name: Sarah
name: Sarah
/*This program is used to take name of the user
You can get the name from the user
and display the result*/
let name = prompt("Enter your name:");
console.log("Name " + name);
Output
Enter your name: Sarah
Name Sarah
Which of the following operators is used as a comment in JavaScript?
1. //
2. <!-- →
3. #
4. **
Answer: 1