var arr = [12, '+', 13, '/', 5, '-', 6];
var result = 0;
var op = '';
for(var i = 0; i < arr.length; i++) {
switch(typeof arr[i]) {
case 'string':
op = arr[i];
break;
case 'number':
switch(op) {
case '+':
result += arr[i];
break;
case '-':
result -= arr[i];
break;
case '*':
result *= arr[i];
break;
case '/':
result /= arr[i];
break;
default:
result = arr[i];
break;
}
break;
}
}
console.log(result);