I take it you're trying to build a calculator. I'd personally create different functions for adding, subtracting, etc. You could use eval(), but that's prone to XSS.
Here's a simple calculator showcasing the minus pre-built into the JavaScript calculation, so that you don't have to worry about extracting it from the input:
function add() {
document.getElementById('answer').innerHTML = Number(document.getElementById('input1').value) + Number(document.getElementById('input2').value);
}
function subtract() {
document.getElementById('answer').innerHTML = document.getElementById('input1').value - document.getElementById('input2').value;
}
<input id="input1">
<input id="input2">
<button onclick="add()">Add</button>
<button onclick="subtract()">Subtract</button>
<div id="answer"></div>
Hope this helps! :)