How do i eliminate the trailing zero in the javascript calculator

How do i get rid of the zero that appears in my input. Above is my fifth attempt at it which also hasn’t worked

this is the link to my code:

When the calculator loads and I click a number, you will see from adding the console.log statement below, the “0” element is present in numArr.

      let numArr = calc.input.toString(10).split("");
      console.log(numArr); // ["0"]

The next line is the problem:

let noZero = numArr.shift().toString();

Do you understand what the return value of the shift method is? You are taking that value, converting it to a string and then assigning it to noZero. You should check what is getting returned and then decide if you want to use the returned value or not.

Shift returns the “0” that i was trying to get rid of. Thank you for this. I still have no solution but at least i got rid of one mistake.

I tried to use the filter function but my calculator displays “NaN8” when i clear then click on 8

  if (calc.input === 0) {

You are already checking if the calcl.input is 0, so why don’t you just specify what you want to pass to setCalc in that situation. Then in an else statement, do something different?

FYI - Your calculator styling (fonts, colors, layout) looks almost identical to another project, so make sure yours is unique.

Thank you! Everyday i thank the universe for the FCC team

You’re right. I followed this tutorial

It was a huge help. I will redo the look of the app after i have achieved full functionality