I want to make it so you enter 2 numbers click a button and it performs the calculation, however it is not doing what I want it to and I am not sure as to why. Also the addition part is adding the numbers as though they are strings and I'm not sure why either.
<html>
<head>
<script>
function Calculation(Type) {
let num1 = document.forms["Arithmetic"]["Number1"].value;
let num2 = document.forms["Arithmetic"]["Number2"].value;
if (Type = "ADD"){
alert(num1+num2);
}
if (Type = "SUB"){
alert(num1-num2);
}
if (Type = "MUL"){
alert(num1*num2);
}
if (Type = "DIV"){
alert(num1/num2);
}
}
</script>
</head>
<body>
<div style = "text-align: center">
<form name="Arithmetic" onsubmit = "return Calculation()">
Number1: <input id = "Number1" type = "number" name = "Number1">
<br>
Number2: <input id = "Number2" type = "number" name = "Number2">
<br>
<button onclick="Calculation("ADD")">Add</button>
<button onclick="Calculation("SUB")">Subtract</button>
<button onclick="Calculation("MUL")">Multiply</button>
<button onclick="Calculation("DIV")">Divide</button>
</form>
</div>
</body>