+ 1
How to take input in JavaScript in only numeric format??
How to take input in JavaScript in numeric format only and not in alphabets or any other format like in HTML, we can take inputs in number only i.e.: <input type="number">
1 Antwort
+ 5
No. The direct way to input in JavaScript is prompt() function.
For getting number from input, try this way.
var a = prompt("Enter a number");
a = parseInt(a,10);
//10 is radix
alert(a+1);