I was trying to make a really simple & basic calculator with JS. For the "addition" portion of the calculator the numbers that are put in won't add properly... FOR EXAMPLE: 12 + 12 comes out as "1212" not 24 OR 6 + 15 comes out as "615" not 21 Can anyone tell me why?
<!DOCTYPE html>
<html>
<head>
<button onclick="Divide()">Divide</button> </br>
<button onclick="Multiply()">Multiply</button> </br>
<button onclick="Add()">Add</button> </br>
<button onclick="Subtract()">Subtract</button> </br>
<script>
function Divide (){
var dividend = prompt("What is the dividend?")
var divisor = prompt("What is the divisor")
var answer = prompt(dividend / divisor)
}
function Multiply (){
var Number1 = prompt("What is the first number")
var Number2 = prompt("What is the second number")
var answer = prompt(Number1 * Number2)
}
function Subtract (){
var Number1 = prompt("What is the first number")
var Number2 = prompt("What is the second number")
var answer = prompt(Number1 - Number2)
}
function Add (){
var Number1 = prompt("What is the first number")
var Number2 = prompt("What is the second number")
var answer = prompt(Number1 + Number2)
}
</script>
</head>
<body>
</body>
</html>