Hey i need help with my javascript calculator project. I did most of the test but its not passing any of them at all is there something Im doing wrong?
Here is the length to my project:
https://codepen.io/jsamuel1/pen/QWwgGWp
Hey i need help with my javascript calculator project. I did most of the test but its not passing any of them at all is there something Im doing wrong?
Here is the length to my project:
https://codepen.io/jsamuel1/pen/QWwgGWp
It appears that you have a Javascript error in your code. Check the spelling for your “click handler” function
fix it its working now thank you
one more question when i click the calculator buttons the numbers are not showing up.
https://codepen.io/jsamuel1/pen/QWwgGWp
There’s an issue with yout if
statement
if(this.state.currentNumber!=="0"){
let currentNumber = this.state.currentNumber
currentNumber += buttonName
}else {
currentNumber = buttonName
}
if you reach the else
case, currentNumber
is undefined and will throw an error, since the variable initialisation/definition is scoped in the if
block.
Finally, mind the rendering of your component.
<Application />
is renderring a <screen />
tag, but be aware that your react.element is <Screen />
.
Hope this helps
Im confused so do i need to remove the if statement?
It looks like you figured it out and getting close to the end when I opened your Pen. Good work!