I'm making a calculator. And the challenge is not to use eval()
. I made an array from all the inputs that looks like this:
numbers = [1,1,'+',2,'*',3,'-','(',4,'*',5,'+',2,'/',5,')'];
Then i convert this array to a string, remove the , and i get a string like this:
numberString = "11+2*3-(4*5+2/5)";
So my question is, what is the way to correctly calculate the result of this equation without using eval()
?