I am trying to make a place where you type in a number that is between 1-8 in four different boxes and it adds up the total and the page says "Your total point is _____ ". However, for example, if I enter in 2 in all the boxes the result is '2222'.
I tried this:`
<form onsubmit="calculatetotal(event)">
event.preventDefault()
<p11>math</p10><input class=" w3-border w3-round w3-hover-green "; type="number" id="a" value="a" required><br><br>
<p11>sci</p10><input class=" w3-border w3-round w3-hover-green"; type="number" id="b" value="b"required><br><br>
<p11>English</p10><input class=" w3-border w3-round w3-hover-green"; type="number" id="c" value="c"required><br><br>
<p11>MTL/HMTL</p10><input class=" w3-border w3-round w3-hover-green"; type="number" id="d" value="d" required><br><br>
<input type="submit" id="submit">
</form>
<h6 id="demo2"></h6>
<script>
function calculatetotal(event) {
let M = document.getElementById("a").value;
let sci = document.getElementById("b").value;
let el = document.getElementById("c").value;
let mt = document.getElementById("d").value;
// calculation for total al points
let total = Math.floor(M + sci + el + mt);
//results
document.getElementById("demo2").innerHTML = "Your total point is " + total;
}
</script>`
Can someone help me correct the math.floor