You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I noticed that the input space of the calculator after getting the result and clicking any number is not cleared, it stays there and the clicked number is displayed as an additional digit to the input value.
I suggest altering the adder function in cal.js file to the following code:
Before
- function adder(k){
valEl.innerText += k
if(k=='*' || k=='+' || k=='-' || k=='/'){
compute(0)
}
}
After
+ function adder(k){
if (/\d/.test(k)) {
if (resEl.innerText[0] == '=') {
valEl.innerText = ""
resEl.innerText = ""
} }
valEl.innerText += k
if(k=='*' || k=='+' || k=='-' || k=='/'){
compute(0)
if (resEl.innerText[0] == '=') {
resEl.innerText = ""
}
}
}
Please let me know if you want me to add these changes, thank you.
The text was updated successfully, but these errors were encountered:
Hello, I noticed that the input space of the calculator after getting the result and clicking any number is not cleared, it stays there and the clicked number is displayed as an additional digit to the input value.
I suggest altering the adder function in cal.js file to the following code:
Please let me know if you want me to add these changes, thank you.
The text was updated successfully, but these errors were encountered: