I need help solving the equation in my calculator i am building. Before i show you it, heres something to keep in mind:
var equation = 9+9
console.log(equation) // 18
You can further play with this @ https://repl.it/@John_Nicole/BoldUnderstatedLoaderprogram
That returns 18. I am trying to replicate this in my calculator. The issue is that it isn’t working when i try to do this. https://codepen.io/Mike-was-here123/pen/PQOYjB?editors=1010
You can skip through most of the code, line 42 is what code is executed when i press enter. I put some comments to help. Line 43 turns the array (equation) it into a string. The array had numbers, symbols pushed into it as you can see on lines 30 and 25.On line 45 it goes through and turns the numbers from strings to real numbers and can be confirmed on line 46 (check console). This is so i can try and replicate what i did in the repl.it.
On line 49 i send equation to the console, just as in repl.it, with real numbers and symbols. Yet i get, for instance 9+9 instead of 18. My equation just isn’t solving like in the example, and if i check the type of equation it returns a string.
Why is it doing this?
Please ask for any clarification
Oftopic: Having dual Monitors is pretty useful. While i’m waiting for replies i can do other stuff.