let arr=["1.0","+","2.0","÷","3","×","10","-","8"] let result=arr[0] for(let i=0;i<arr.length;i++){ switch(arr[i]){ case "+": result=Number(result)+Number(arr[i+1]) break case "-": result=Number(result)-Number(arr[i+1]) break case "×": result=Number(result)*Number(arr[i+1]) break case "÷": result=Number(result)/Number(arr[i+1]) break default: break } } console.log(result)