how to get a user input in js

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

Also in JavaScript: