Build a JavaScript Calculator 14/16?

Greetings,

I’m unable to pass #9 and #13.

##9. In any order, I should be able to add, subtract, multiply and divide a chain of numbers of any length, and when I hit “=”, the correct result should be shown in the element with the id of “display”

13. If 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative (-) sign.

Here’s my CodePen.

https://codepen.io/amreed8/pen/zYeradX 

Thanks!

I’ve overhauled the code:

My Code Pen

Now, I’m unable to pass 13.

13. If 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative (-) sign.

hello and welcome to fcc forum :slight_smile:

currently in your implementation, you are not correctly handling “multiple operator” at same time

try to get correct values for these use cases

  • 3*+3 = 6
  • 3±*3 = 9 (this gets you error)

happy coding :slight_smile:

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