Project calculator from front end libraries certification is not passing

Hi all!
I have just finished my calculator project from front end libraries certification. It is working as expected but the javascript cdn built by freecodecamp is not passing the test. can anyone help me where the problem is. Or if anyone else is having the same problem should we report a bug issue?

Here is the link to my calculator project

You have two elements for displaying the data.

The challenge expects the input (entering the numbers/operators) and the result (expression output) in the same id="display" element.

And there’s one more minor bug too.

Here’s the updated pen:

Read the comments I added on Line #120, #128 and #134

1 Like

Very well thought-through comments, and valuable insights. Well done, @husseyexplores.

As a general rule, at this point in your JS education, plan on commenting your code EXTENSIVELY. Write yourself notes about the lines to come, what you intend for them to do or what you should expect.

Often, before creating a function, I will create a comment block about that function and its purpose:

 * handleEqualBtn()
 *   This function should be called when the equals button is clicked
 *  It first checks that the last char is NOT an operator, then evaluates
 *  the expression. The result of that evaluation is updated in the  state, and
 *  ..... More and more commentary, plan to "pseudocode" your code.

When starting out, write comments for everything. If a line doesn’t do what you expect, leave a note there while you’re debugging. Then, if you ask for help, those notes can help others understand your intent.

As you move forward, you may use comments less and less, and most minification tools will remove them from production code. But for developing? Comment, comment, comment.


Thank you all for reaching out!
@husseyexplores thanks for catching that out. you are great :+1: