You can use eval if you want dynamically evaluate operators in that way:
var answer = eval(right_digit + sign[0] + left_digit);
Note that the use of `eval is not recommended because of potentional security issues (if the data is untrusted) and slow because the code has to be analysed each time it's executed.
A better way would be using a switch like this:
function calculate(a, operator, b) {
switch (operator) {
case "+":
return a + b;
case "-":
return a - b;
case "*":
return a * b;
case "/":
return a / b;
}
}
var answer = calculate(right_digit, sign[0], left_digit);
1 + 5.