How's my JS/HTML Calculator? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How's my JS/HTML Calculator?

It has a variety of buttons. When a button is clicked, a function is fired to add a number, a series of numbers or a character to a string. Once the equals button is clicked, a mathematical JS parser is fired to parse the said string and get an answer. (Debounce) It'll set the class of a certain tag to something when the = button is pressed or an error occurs. Then, when another digit is pressed, it'll check to see if the string has that class. If it does, it'll clear the string first.

5th Dec 2016, 1:28 AM
Ben
Ben - avatar
5 Answers
+ 4
@Chinny: I think "it's" is a contraction...unless you meant 'retard' as a friendly 'chinning' ;)
13th Jan 2017, 4:44 PM
Kirk Schafer
Kirk Schafer - avatar
+ 4
Interesting behavior with double decimal points (8.8.9 + 0 helps show what's happening).
13th Jan 2017, 4:49 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
I think its perfect
8th Jan 2017, 2:47 AM
Chinny A
Chinny A - avatar
+ 2
;)
13th Jan 2017, 5:06 PM
Chinny A
Chinny A - avatar
+ 2
Just noticed @Kirk. I'll look into it soon, thanks for letting me know.
13th Jan 2017, 5:24 PM
Ben
Ben - avatar