Why wont my calculator function complete the math?
Why wont my calculator function complete the math? Hi so I'm having trouble figuring out why my function will do the division but leave the multiplication as an array without completing the math. Here's the code: const mathObj = { "*": function(a , b) {return a * b}, "/": function(a , b) {return a / b}, "+": function(a , b) {return a + b}, "-": function(a , b) {return a - b} } const arr = [ 10, "/" , 2 , "*" , 10 , "/" , 2 ]; function solveTheMath(arr) { const len = arr.length; for(let i = 0 ; i < len ; i++){ if(arr[i] === "/" || arr[i] === "*"){ const sliced = arr.slice(i - 1 , i + 2); var mathResult = mathObj[arr[i]](sliced[0], sliced[2]); arr.splice(i - 1 , 3, mathResult); console.log(arr); //[5*5] } } } solveTheMath(arr); Why does...