Pls why does this code treat the inputs as strings and not numbers. And how can I make it treat it as numbers??
use parseInt() to conversion var n1 = parseInt(prompt("Enter first number")); var n2 = parseInt(prompt("Enter second number")); document.write(n1 + n2)
parse is used to convert one data type to other like in above code string is converted in integer value
What's parseInt? What does it mean pls
GAWEN STEASY So if I use it in a string it tries to convert it to an integer?