Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaScript Calculator displays an incorrect formula #49045

Open
diegoperezm opened this issue Jan 16, 2023 · 18 comments · May be fixed by freeCodeCamp/demo-projects#380
Open

JavaScript Calculator displays an incorrect formula #49045

diegoperezm opened this issue Jan 16, 2023 · 18 comments · May be fixed by freeCodeCamp/demo-projects#380
Labels
help wanted Open for all. You do not need permission to work on these. scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.

Comments

@diegoperezm
Copy link

diegoperezm commented Jan 16, 2023

Describe the Issue

JavaScript Calculator displays an incorrect formula.

Affected Page

https://javascript-calculator.freecodecamp.rocks/

Your code

+0+0+0+0+0+0+-1=

Expected behavior

  • It should not display 3 hyphens before the number 1
  • It should not display hyphens of different types

Screenshots

incorrect-formula

incorrect-formulat

System

Device: Laptop
OS: Ubuntu 18.04.5 LTS
Browser: Chromium
Version: 90.0.4430.72

Additional context

https://www.freecodecamp.org/learn/front-end-development-libraries/front-end-development-libraries-projects/build-a-javascript-calculator

@diegoperezm diegoperezm added scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc. labels Jan 16, 2023
@Rishab49
Copy link

it is working fine only my device
os : windows 10
browser : chrome version 108.0.5359.126

@timagixe
Copy link

Screen.Recording.2023-01-16.at.6.16.37.PM.mov

For me it also seems to be a bit buggy. Please refer to the attached video.

@Rishab49
Copy link

Where can i find code of this calculator?

@RishabhSingh4872962
Copy link

RishabhSingh4872962 commented Jan 17, 2023

i can fix it please assign me

i can fix both of problem invalid input and incorrect formula

@moT01
Copy link
Member

moT01 commented Jan 17, 2023

The code for this lives in our demo-projects repo.

@moT01 moT01 added help wanted Open for all. You do not need permission to work on these. and removed status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. labels Jan 17, 2023
@scottykrieg
Copy link

I'd like to add the ability to use keyboard commands as well as mouse-clicked buttons on the calculator.

@mikeleonida
Copy link

For me it looks like the original buggy input has been fixed as it gives the result in the screenshot.
Platform: Ubuntu Linux 22.04
Browser: Firefox 108.0.2
Screenshot from 2023-01-27 15-15-34

@spiritanand
Copy link
Contributor

Has anyone started on this? I would like to collaborate if anyone has.

@Aman300801
Copy link

I Would love to contribute on it also, And its my first contribution also. Do let me know how to contribute

@CallmeHongmaybe
Copy link
Contributor

I'm in this one too. Where do we start ?

@spiritanand
Copy link
Contributor

@CallmeHongmaybe lets connect over email to collaborate further on this problem.

@CallmeHongmaybe
Copy link
Contributor

CallmeHongmaybe commented Feb 5, 2023

Okay email sent. And for the record, I can reproduce the exact same error as the OP's.

@spiritanand
Copy link
Contributor

Hey maintainers,
how can I and @CallmeHongmaybe collaborate on this issue together? Is it possible for two people to collaborate on the same issue?

@moT01
Copy link
Member

moT01 commented Feb 15, 2023

The code for this project lives here. If anyone wants to try and fix this issue, we would accept the changes.

You can collaborate however you want @spiritanand - get in touch with each other and pair up on it.

@spiritanand
Copy link
Contributor

Yeah, @moT01! We will solve the problem together, but how will we get both of us assigned as the contributor of the PR we create?

@jadhavsiid
Copy link

Works fine on my PC

@ValdineiJunior
Copy link
Contributor

Platform: Windows 10 Pro
Browser: Chrome Versão 114.0.5735.110
I was testing a few different inputs and found this behavior:
For example, when typed just "=" it gives the result NaN. If you use an operator, it includes NaN in the sum.
As in "= + 15 =" results in "NaN ".
When result is Ifinity as in "10/0" and operator is used, also use Ifinity in the sum.
Only when typing a number does it discard the previous result. I believe it is not necessary to use NaN or Ifinity in sums.
Screenshot_1

@Harshan-Nayak
Copy link

Screenshot 2023-12-06 213512

I had observed an UI issue, while multiplying two numbers , 'x' symbol should be used for multiplication for better user experience,

But instead, Dot ' . ' symbol is used .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Open for all. You do not need permission to work on these. scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.
Projects
None yet
14 participants