You are on page 1of 1

Getting input from user

prompt( ) – The browser provides a built-in function which can be used to get input
from the user, named prompt. The prompt( ) method displays a dialog box that prompts
the visitor for input.
Once the prompt function obtains input from the user, it returns that input.
Syntax: - prompt(text, defaultText)
Ex:- prompt(“Enter Your Name: “, “name”);
prompt(“Enter Your Roll No. : “);

You might also like