I am making a four function calculator with javascript. I am storing the button presses in an array 'tmp', removing operators from the beginning and end of the array, converting to a string, and removing commas.
Any given string should be properly formatted for calculation except for the fact that it's in a string. What's the best way to get it out of the string and calculated?
thanks!
"-4*2"you're doing4*2? Is that a good idea? Also if you have say this input:"-1+2*2/"and you get this array:["1", "+", "2", "*", "2"]what's your expected result?