So i'm quite new to javascript and im trying to make this thing where i enter 2 values and it will either plus, multiply, divide etc. from what i enter in the code. But somehow when i try to multiply 5*2 it will show 10 but when i try 5+2 it will show 52, how do i fix this? I tried parseInt() but it didnt work
[Output][1]
Code:
function myfunction() {
var x = document.getElementById("fname").value;
var y = document.getElementById("lname").value;
var z = x + y;
document.getElementById("output").innerHTML = z;
<form>
<input type="Number" id="fname" value="" ><br><br>
<input type="number" id="lname" value="" ><br><br>
</form>
<button type="button" onclick="myfunction()">submit</button>
<p id="output"></p>