#textContent problem

2 messages · Page 1 of 1 (latest)

brittle dragon
#

In this calculator app below, the displayNum textContent (line 25)only displays one number after I hit an operator button

https://scrimba.com/scrim/cVMvQ6cE

Scrimba

Learn to code with interactive screencasts. Our courses and tutorials will teach you React, Vue, Angular, JavaScript, HTML, CSS, and more. Scrimba is the fun and easy way to learn web development.

covert lichen
#

You set calculator.dataset.previousKeyType = 'operator' when you press an operator but you never reset it anything else when you press a number button... so once it's set to operator is STAYS that way...

So now when you check the previousKeyType on line 31 you check if it's an "operator" however this is set at line 26 to be the calcualte.dataset.previousKeyType... Oops... once it's an "operator" it stays there...