String Calculator in Javascript