FCC React Calculator

Hi there,

after long days of coding and handling the craziest edge cases I think I did it. I just miss one project to get my frontend certification and I’m surprised… :stuck_out_tongue:

image

This is the link to my React Calculator

Hope there are no more bugs :bug:

Sergio

2 Likes

hey
i liked the layout, you did well with the design, however i guess you forgot to handle the user story n°13

User Story #13: If 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative ( - ) sign). For example, if 5 + * 7 = is entered, the result should be 35 (i.e. 5 * 7 ); if 5 * - 5 = is entered, the result should be -25 (i.e. 5 * (-5) ).

1 Like

Hey there,

thanks for the feedback! :slight_smile:
I dind’t forget, simply I don’t like that…I think is a cleaner way to do it like I dit, just change the operator on the fly.

Your calculator looks good @Eidan. Some things to revisit;

  • Keep the test script when forking the pen (<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>)
    • The test script, with all tests passing, should be included when you submit your projects.
    • Your page passes 14/16 user stories. Click the red button to see which test(s) are failing and text to help you correct the issue.
    • Be sure and read more than just the first line of the failing message. The ability to read and comprehend error messages is a skill you’ll need to acquire as a developer. Ask questions on what you don’t understand.

I’m not sure I understand this response. It’s not the way math, or a calculator, works.
5 * -5 is valid and should produce -25

On a side note, do a search and find out why you don’t want to use the eval function.

You are aboslutely right. I must pass all tests to be valid. :slight_smile: I need to change that!

Hey there, all the tests are passed now. Thank you very much again. :slight_smile:

1 Like

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