javascript & Uncaught TypeError: arr is not iterable bug All In One
function compute(arr) {
const [left, symbol, right] = arr;
switch (symbol) {
case "*":
result = left * right;
break;
case "/":
result = left / right;
break;
case "+":
result = left + right;
break;
case "-":
result = left - right;
break;
}
return result;
}
undefined
const [left, symbol, right] = arr2;
undefined
compute(arr1.push(compute(arr2)));
VM886:2 Uncaught TypeError: arr is not iterable
at compute (<anonymous>:2:35)
at <anonymous>:1:1
compute @ VM886:2
(anonymous) @ VM906:1
compute(arr2);
6