input function js code example Example 1: input js var answer = prompt("Ask your question here"); Example 2: input in js var answer = prompt("Question")