+ 1

How to create a calculator using Javascript?

I want to create a calculator that when I press the operator(+- / %) the value of my input type text is saved to another variable as number while the value of input is erased. I know how to make string a number I just have a problem with the erased value. Please help thanks.

3rd Mar 2017, 11:18 AM
Zohar Revivo
Zohar Revivo - avatar
3 Réponses
+ 18
eval(stringCode) can be helpful......
3rd Mar 2017, 1:23 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 5
Look at user codes in playground: many have write ( or save sometimes ^^ ) some calculators implemented in JS... Not, a complete one, but an example made to understand the principle: https://code.sololearn.com/WzS1Rzioz166/#js
4th Mar 2017, 8:31 AM
visph
visph - avatar
+ 1
Thanks :)
4th Mar 2017, 4:47 PM
Zohar Revivo
Zohar Revivo - avatar