Java Script variable may be used to store a value and declared as var var a=10, here 10 is stored in variable a . Variables may be local and global variable. Variable type depends on the value it stores. eg var i=10; (integer value) var name=”Sharp Tutorial” (String Value)
prompt() is used to take the input from the user and parseInt() to convert string to int.