JS Calcualtor for FCC project

Hello everyone. Can someone tell me why i cannot currently see my calculator? Thank you!

Oh, and feel free to tell me what you think of the calculator so far…once you can see it. :grinning:

Hello there,

You have not named your component:

class extends React.Component {

Hope this helps

1 Like

Oh, duh! That was so silly of me! It’s all fixed now. Thank you!

My calculator has disappeared again. Please help me. Thank you guys.

@nhcarrigan I would appreciate your assistance and input. You are my favorite moderator. Thank you!

I’m sorry guys. I still need help. I still haven’t figured this out.

Remove the } on line 41. It’s extra. :slight_smile:

1 Like

Whoops. This while time. :face_with_hand_over_mouth: Thanks. I’m very embarrassed now.

1 Like

That’s how it goes!

BTW, I found this by pasting the code into my VSCode and checking it with my linter. :slight_smile:

1 Like

No way! Lol. Thank you!

What do you think of the calculator?

It looks very nice. You’ve still got some work to do, but you’re off to a great start!

1 Like

Thank you very much!

Hello guys! I am much further into my project now. But I have run into an error. My console gives no error. So I need your help, why can’t I see my calculator again? I should be able to at this point.

Hello there,

You have syntax errors here;

switch(innerText) {
      case 'AC': {
          currentNumber: '0',
          calc: undefined
        case: '=' : {
          const evaluated = eval(calc);
          currentNumber: evaluated,
          calc: evaluated

@Sky020 beat me to it, but yes you have a syntax error.

Again, it was something I discovered using the formatter in VSCode. I recommend opening up your VSCode and running your code through there if this bug happens again, as the CodePen formatter/linter doesn’t seem to catch everything it should. :slightly_smiling_face:

1 Like

Oh, how silly of me!

Thank you @Sky020 and @nhcarrigan. From now on I’ll surely be using VS Code for help. lol

Hello, everyone, it’s been a while since I’ve had any trouble with my calculator, and I hope i get done soon, but I have a problem again. My calculator is invisible…again. I pasted my code into VS Code but I got no errors, so I need help. Thank you!

You have declared the variables calc and innerText twice.

Edit: I would suggest using CodeSandbox for React instead of Codepen.

1 Like

I’m sorry, could you tell me which lines my problems are on? I’m very confused and can not seem to find them.

Lines: 13, 14, 47, 48, (technically 116, but that is inside its own block scope)

1 Like

Thank you, I figured it out. I shouldn’t have even had a line 116, I only have 72 lines now. :crazy_face: :grinning: