JavaScript Calculator issue on user story 11

Tell us what’s happening:
I had a failed user story which is:

When the decimal element is clicked, a “.” should append to the currently displayed value; two “.” in one number should not be accepted.

An input of “5 . 5 . 5” should display 5.55 : expected ‘5.5.5’ to equal ‘5.55’

So I need to convert 5.5.5 to 5.55.
I need help to do that.
Any Help or tips?

My project link:

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Firefox/91.0

Challenge: Build a JavaScript Calculator

Link to the challenge:

hey abdulrahman.mhd.anas,

I think you misunderstood the error message of the test a bit.

A number containing two “.” signs should not be accepted.

So if the user types in “5.5.5”, you should not accept the input instead of changing it to “5.55”.


But I want help how to do that in real code?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.